OpenText Archive Server 10.5 - Programming Guide For The OpenText Archive Server API English (AR100500-PSA-En-3)
OpenText Archive Server 10.5 - Programming Guide For The OpenText Archive Server API English (AR100500-PSA-En-3)
AR100500-PSA-EN-3
OpenText™ Archive Server
Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
Rev.: 2015-Sept-08
This documentation has been created for software version 10.5.
It is also valid for subsequent software versions as long as no new document version is shipped with the product or is
published at https://knowledge.opentext.com.
Open Text SA
Tel: 35 2 264566 1
Tel: +1-519-888-7111
Toll Free Canada/USA: 1-800-499-6544 International: +800-4996-5440
Fax: +1-519-888-0677
Support: http://support.opentext.com
For more information, visit https://www.opentext.com
Copyright © 2015 Open Text SA and/or Open Text ULC (in Canada). All Rights Reserved.
Trademarks owned by Open Text SA or Open Text ULC (in Canada). All rights reserved.
Disclaimer
Every effort has been made to ensure the accuracy of the features and techniques presented in this publication. However,
Open Text Corporation and its affiliates accept no responsibility and offer no warranty whether expressed or implied, for the
accuracy of this publication.
Table of Contents
1 Introduction ................................................................................ 7
1.1 About OpenText Archive Server API ................................................... 7
1.2 About this document .......................................................................... 7
1.2.1 Target group and prerequisites .......................................................... 7
1.2.2 Structure .......................................................................................... 7
1.2.2.1 What to read first? ............................................................................. 8
1.2.3 Related documentation ...................................................................... 9
1.3 Abbreviations and important terms ..................................................... 9
OpenText Archive Server – Programming Guide for the OpenText Archive Server API iii
AR100500-PSA-EN-3
Table of Contents
iv OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
Table of Contents
OpenText Archive Server – Programming Guide for the OpenText Archive Server API v
AR100500-PSA-EN-3
Table of Contents
vi OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
Chapter 1
Introduction
Archive Server The Archive Server API is a C++ and Java library primarily intended for being
API integrated into applications, operating on a less abstract level. Both provide direct
access to Archive Server and can be easily incorporated into your applications for
accessing and storing documents on the server, modifying document properties etc.
1.2.2 Structure
The manual consists of five chapters:
• The first chapter (i.e. this chapter) provides some introductory information on a
high and abstract level – about the manual itself and about the Application
Programming Interfaces (API) related to Archive Server.
• The second chapter, “Concepts and basics“ on page 11 deals in greater detail
with basic ideas and concepts. Among other things, you will learn
• a bit of the topology in a system referring to Archive Server (in other words:
"your" future neighbors)
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 7
AR100500-PSA-EN-3
Chapter 1 Introduction
Troubleshooting information
1. Browse through the sections in “Concepts and basics“ on page 11 and check
which sections are important to you:
8 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
1.3. Abbreviations and important terms
2. Then you may wish to browse through “libdsh function reference“ on page 37
and study the description of those functions that are important to you.
3. Finally – or as an alternative – look at “Archive Server API in practice“
on page 193 and work through the examples and consult the respective function
descriptions in Chapter 3 on page 37 for further details.
ADMS
Administration Server (see “Servers, clients, leading application” on page 11).
AID
Archive ID, the name of a logical archive (see “Logical archives, pools, storage
tiers” on page 12).
API
Application Programming Interface
Archive Server
The central server unit and related services storing the content (documents) –
see “Servers, clients, leading application” on page 11.
DER
Distinguished Encoding Rules (DER)
A specific encoding method – see 3 on page 225 in “Further information
sources” on page 225
DLL
Dynamic Link Library
DMS
Document Management System.
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 9
AR100500-PSA-EN-3
Chapter 1 Introduction
docid
Document ID (name), a unique identifier of a document (see “Document ID”
on page 14).
(“Record ID” in Systems based on AS)
GUI
Graphical user interface
HTTP/HTTPS
HTTP is an acronym for Hypertext Transfer Protocol, the most common
communication protocol for internet communication. HTTPS is a modification of
that protocol for secure (encrypted) communication.
libdsh
The core C++ library providing the local functionality for accessing the Archive
Server API.
MIME
Multipurpose Internet Mail Extensions, a convention for describing file formats
– see [2 on page 225] in “Further information sources” on page 225 and
“Document/component formats (renditions, file types)” on page 19.
Repository server
The repository server is the central server, i.e. the communication peer for the
Archive Server API in your application. Depending on your actual system
configuration, this can be a TCP Context Server, a server hosting Enterprise
Library or Archive Server.
SecKey
A means for protecting documents against unauthorized access – see “Access
protection via SecKeys (signed URLs)” on page 22 for details.
URL
Uniform Resource Locator, an address on the Internet (or a file/document
location specification using this syntax)
WORM
Write Once, Read Many, a magneto-optical medium (disk) that can be
overwritten.
XML
Extensible Markup Language, a universal file format for structured documents
and data on the Web (see http://www.w3c.org).
10 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
Chapter 2
Concepts and basics
libdsh Before looking at “your” neighbors, however, you should know a bit more about
library “yourself”, i.e. the Archive Server API: In fact, this API consists of a function library,
which you refer to from within your applications, and corresponding
communication partners on Archive Server. The library that provides the respective
functionality on your site is the libdsh library. So, as a rule, this manual deals with
the libdsh library rather than with the Archive Server API as a whole.
Java libraries The functionality provided by the libdsh library is also provided by Java libraries.
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 11
AR100500-PSA-EN-3
Chapter 2 Concepts and basics
(OpenText Imaging Enterprise Scan. Those clients, which are used by end users
to work with documents, are called OpenText Imaging Clients.
Note: Note that the term “server” may mean both the computer hardware
hosting the server software as well as the server functionality itself. This also
applies to the term “client”: It may mean either the specific functional unit on a
computer or the hosting computer itself.
Notes
• If using libdsh, please note that your application must specify both the
Document ID and the logical archive for retrieving or modifying a
document, and it must specify a logical archive for storing a document. In
other words, your application must provide a means for “remembering”
both the respective Document ID and the logical archive.
• Instead of “logical archive”, frequently just the term “archive” is used. Note,
however, that “archive” might also mean the document archive as a whole.
• See also Section 2.4 “Logical archives” in OpenText Archive Server -
Administration Guide (AR-ACN).
Document Each logical archive is subdivided into one or more document pools. These pools are
pools, storage needed to assign storage devices.
tiers
• Storage tiers
Used to sort components according to their use in the leading application, for
example, to distinguish between different relevance levels or to separate
documents according to their access frequency.
See Section 12.4 “Creating and modifying storage tiers” in OpenText Archive
Server - Administration Guide (AR-ACN) for further details.
Notes
• Storage tiers are available only in Archive Servers with software version
9.7 or higher and need libdsh_3 to be addressed.
• Some functions in libdsh provide parameters to specify a pool name and
a storage tier. Ensure that you do not specify more than one of these
parameters in a function call, otherwise the call will fail, if the parameters
result in specifying different pools to be used.
12 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
2.1. Archive Server and its neighbors
Note: In libdsh functions for storing or modifying documents, the storage tier
can be specified via the storage_tier function parameter, respectively. Make
sure that the string specified in this parameter matches the corresponding
strings specified in the archive configuration. Note that these parameters are
case-sensitive (as most libdsh parameters are).
libdsh supports the communication via a proxy server. As soon as you specify a
proxy server via the dshSetProxy function, libdsh and the repository server
communicate exclusively via this server. If the proxy server is not available, libdsh
cannot contact the repository server.
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 13
AR100500-PSA-EN-3
Chapter 2 Concepts and basics
Calls coming from the Archive Server API always retrieve the current version of a
document.
Document In the Archive document model and thus in Archive Server, a document is a
logically encapsulated data package consisting of components (see sections
“Document ID” on page 14 and “Components” on page 15).
The central element in libdsh is the component, not the document (see “Components
in libdsh” on page 17).
2.2.2 Document ID
Alphanumeric Each archived document is identified in Archive Server by the Document ID, shortly
ASCII string DocID. This is simply a chain of alphanumeric ASCII characters[1] that appears quite
arbitrary to human users, e.g., aaay65qz5oytuj36zajhfgjmqxvzk. This Document
ID uniquely identifies a document within the archive.
Generation The DocID can be created by Archive Server: If a document is sent to Archive Server
of the DocID to be archived, the server automatically assigns a unique Document ID and returns
this ID to the process sending the document.
Notes
• Document ID and logical archive required for retrieval
When your application retrieves a document, it must specify the Document
ID and the logical archive where the document has been stored. Therefore
make sure that your applications store both the Document ID and the logical
archive for a document, when they send it to the archive.
[1] i.e. a...z, 0...9; no special characters, dashes or punctuation characters
14 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
2.2. Document structure and archive document model
2.2.3 Components
Components Documents are structured in several components. Each component is a file that is
not interpreted further. A document is thus similar to a directory in which the file/
component is located.
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 15
AR100500-PSA-EN-3
Chapter 2 Concepts and basics
component of the same document. You should not insert each TIFF page into a
separate document, as this may confuse the OpenText Imaging Clients.
• Notes and annotations
Notes and annotations can be added to the document by the user to highlight or
comment parts of the contents. Notes are text remarks, whereas annotations are
graphic markings (for example, yellow highlighting with a virtual text marker, or
underlining). These are stored in a separate graphic layer file.
All notes are collected in the notes component, whereas all the annotations
together make up the annotations component (but also see “Components in
libdsh” below).
2.2.4 Attributes
Attribute A document and each of its components may also have so-called document/component
attributes for administering the document; these are stored separately from the
document components, in the server database. The format of these attributes is
name=value, where name and value are character strings. Attributes can be defined
when the document is saved for the first time, or they can be deleted, modified, or
added at a later stage.
Predefined: Archive Server uses one predefined document attribute that should only be used in
TYPE attribute this context: The type attribute of the document defines the file type of its content
unit (see “Document/component formats (renditions, file types)” for further details).
Further arbitrary attributes can be defined by any application accessing Archive
Server, but are not supported by the OpenText Imaging Clients.
Additional information:
Important
• Apart from document attributes, Archive Server stores further information
for each component, but not via attributes. In particular, there is a type
specification for each component, too, which is no attribute.
See also “Document/component formats (renditions, file types)” on page 19
and “dshDsInfo: Get info string for document/Component” on page 86.
• Please note that no further data is stored on Archive Server itself, in
particular no information which could help to find a document later-on.
Therefore, you must have a Document ID (see below) in order to retrieve
a document from Archive Server. However, if the documents in the
archive are managed by an overlying application such as SAP or TCP,
you may use the database of that system to find a document according to
certain search criteria.
16 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
2.2. Document structure and archive document model
Important
Note that the first component usually is interpreted as the main component
(see “Main component” on page 15). Therefore always store the main
component at first.
If you want to access a certain component in a document, you must know the
respective component ID and specify it in the respective libdsh function. As a rule,
component names and types correspond to a convention, which is listed in
“Convention for component names and types ” on page 17. If you use component
names that do not correspond to this convention, your application should store these
names along with the Document ID and the logical archive. If you do not know the
name of a component, you can retrieve the names of all components in a document
using the dshDsInfo function within libdsh.
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 17
AR100500-PSA-EN-3
Chapter 2 Concepts and basics
Distributed on Note that the individual components of a document need not be located in the same
different place within the archive. In fact, notes and annotations are often stored in a different
storage devices
medium (i.e. logical archive or pool) than a content unit, as they can be modified or
extended, while the content unit stays unchanged. Moreover, a document may be
extended over time, when the volume containing the former components is already
full; then, extensions are stored in another volume. Still, these components form a
single document, still, and neither the programmer nor the user will notice this
distribution.
18 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
2.2. Document structure and archive document model
Type Unlike Windows, Archive Server does not store or recognize the format of a file via
parameter the file extension, but via a document attribute (TYPE attribute) or the component
information, that is stored for each component in addition to the component
contents. Therefore, the libdsh functions for storing or modifying a document or
component require that the format of the document or component must be specified
in the function call parameters.
Note: Both the archive document and the component can have a type assigned
to them. For the document, the type is stored in a document attribute, but the
type definition for a component is stored in the component information, not in
an attribute.
The server software no longer requires the document type attribute, as the
relevant information is stored in the component type (this information is used
by the clients, for example, to display the document with the appropriate
viewer software). However, the document type is still maintained for
compatibility reasons, as this attribute may be evaluated by a super-ordinated
software.
Use MIME In libdsh, you should always use MIME syntax to remain up-to-date and to avoid
types! confusion. libdsh converts a type specification that corresponds to the proprietary
syntax, to the MIME syntax, anyway. And some functions, especially if they are
related to component types, even refuse a type specification that does not
correspond to MIME syntax, and return an error.
Notes
• To convert a proprietary file type specification into a MIME type
specification, use the dshGetMimeType function. Table 2-2 provides a list of
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 19
AR100500-PSA-EN-3
Chapter 2 Concepts and basics
libdsh file types The following file types are known by libdsh.
20 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
2.2. Document structure and archive document model
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 21
AR100500-PSA-EN-3
Chapter 2 Concepts and basics
Working SecKeys are an implementation of the asymmetrical encryption method, which can be
principle customized on Archive Server. When a client application wants to access a
document protected via SecKey, it must generate a signed URL. For this purpose, it
creates a SecKey, an information package including an ID for the calling application
or user (the AuthId) and certain key information that allow the target application to
verify the call and the calling application. This SecKey is appended to the URL
addressing the document in the repository server; the URL then is called a signed
URL.
The server verifies the SecKey and gives access to the requested document only if
the verification is successful.
1. The SecKey protection must be enabled on the server for the respective archive.
2. The client must have a key pair (private key, public key and digital certificate)
that is used to create and verify the SecKey information.
3. The keys and the digital certificate must be introduced in libdsh (or the local
application refering to libdsh, respectively).
4. The client must transfer the public key and the digital certificate to Archive
Server (for example, via the respective libdsh functions).
5. The server administrator must accept the public key and certificate of the client
and enable it on the server.
SecKey On the server, the protection can be disabled or enabled for each access mode (read,
access mode update, create, delete) on each logical archive (but only for the whole logical
archive, not for individual documents). The libdsh functions for accessing a
document or component are assigned to one of these access modes. If protection is
enabled for the respective access mode in the requested archive, the function will fail
(DSH_ERR_HTTP_401), unless your application is able to generate SecKeys.
22 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
2.2. Document structure and archive document model
Important
• We strongly recommend to activate SecKey protection. Allowing access
via unsigned URL (no SecKey protection) is insecure.
• A SecKey is a general key, and it is assigned to applications, not to users.
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 23
AR100500-PSA-EN-3
Chapter 2 Concepts and basics
The meaning of retention periods and the related further functionality is described
in detail in Section 12.1.3 “Retention” in OpenText Archive Server - Administration
Guide (AR-ACN) and Section 12.2.4 “Configuring the archive retention settings” in
OpenText Archive Server - Administration Guide (AR-ACN).
Note that there is no way to reduce the retention period once it has been set for a
component. The retention period can be extended by migrating the document to a
different archive (dshDsMigrate) or by using the dshExtendRetention function
introduced with Archive Server 10.5.0.
Admissible The value for the retention period in the function calls can have one of the following
Value values (see also Section 12.2.4 “Configuring the archive retention settings” in
OpenText Archive Server - Administration Guide (AR-ACN)):
• infinite: The retention never expires which means that the component cannot
be deleted.
• none: The component has no retention period, thus is not protected from
deletion, if no other settings prevent it from being deleted.
• Any number specifies the length of the retention period in days. The start of the
retention period depends on context in which the period is set:
• In the functions dshDsCreate* and dshDsSetDocumentFlag, the retention
period starts on the day when the function is called.
• In the dshDsMigrate function, the retention period starts on the creation day
of the (original) component.
• keep (dshDsMigrate read only): The existing retention period is kept.
If you do not specify the appropriate parameter for the retention period in the
function call, this has different consequences in the individual functions:
• In the dshDsCreate* and dshDsMigrate functions, the default retention period
of the archive, where the component is stored, is used.
Note that the value is stored with the document, not as a reference. So even if the
default retention period of an archive should be changed some day, existing
documents in that archive keep their original period.
24 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
2.2. Document structure and archive document model
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 25
AR100500-PSA-EN-3
Chapter 2 Concepts and basics
Communication As a rule, libdsh uses the HTTP or HTTPS protocol to communicate with Archive
protocol Server.
See “Preparations” on page 194 for information on compiling/linking details for the
individual platforms; use of the libdsh library itself does not depend on the
platform.
All variants of a function are described in the same sections in the function
reference.
26 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
2.3. libdsh library
Core functions Of course, the most important functions deal with storing documents on Archive
Server and retrieving them:
• Before you modify or delete a document, use the dshDsLock function to set
the so-called locked flag
Do not forget to check the result returned by the function to make sure that
the document is not in use by another client before you access it yourself.
• dshDsAppendData and dshDsAppendFile append a piece of data (memory
buffer) or a complete file to an existing document component.
• dshDsUpdate and dshDsUpdateFile allow you to modify an existing
document component, i.e. to replace its contents with a newer version.
• To delete a document component, use the dshDsDelete function.
• As soon as the modification is complete, use the dshDsUnlock function to
reset the locked flag.
• The dshDsMigrate function allows you to move a document to a different
logical archive or document pool.
• Retrieval:
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 27
AR100500-PSA-EN-3
Chapter 2 Concepts and basics
Management Apart from these core functions, there are many other functions for the management
functions, of the libdsh session itself and for setting and retrieving SecKey parameters (see
SecKey settings
“SecKey handling in libdsh” on page 31).
Full function list All libdsh functions are listed in alphabetical order in “libdsh function reference“
on page 37, which also provides a detailed description of each function. Another
list, sorted by functionality, is provided in “Grouped function list” on page 28
below.
Logging
• “dshSetLogFile: Set log file” on page 183
• “dshSetLogMaxSize: Set maximum size of log file” on page 186
• “dshSetLogLevel: Set log level” on page 184
Accounting settings
• “dshSetApplication: Set application name ” on page 177
• “dshGetApplication: Get application name” on page 131
• “dshSetUser: Set user name” on page 191
• “dshGetUser: Get user name” on page 156
• “dshDsValidUser2: Check user account” on page 117
28 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
2.3. libdsh library
Communication parameters
• “dshDsAdmInfo2: Get information about archives” on page 48
• “dshSetAidRefreshInterval: Set refresh interval for ADMS info”
on page 174
• “dshGetAidRefreshInterval: Get aid refresh interval” on page 129
• “dshSetAidRefreshTime: Set time of next ADMS info refresh”
on page 175
• “dshGetAidRefreshTime: Get time of next ADMS info refresh ”
on page 130
• “dshSetProxy: Set proxy server” on page 190
• “dshGetProxy: Get proxy server” on page 155
Searching
• “dshDsSearch, dshDsSearch2: Search in component” on page 102
• “dshDsAttrSearch, dshDsAttrSearch2: Search in SAP print list”
on page 59
Document/component attributes
• “dshDsDelAttribute: Delete attribute” on page 70
• “dshDsGetAttribute: Get attributes” on page 81
• “dshDsSetAttribute: Set attribute” on page 105
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 29
AR100500-PSA-EN-3
Chapter 2 Concepts and basics
Deleting a component
• “dshDsDelete, dshDsDelete2: Delete document/Component”
on page 72
Cashing
• “dshCsCache, dshCsCachePart: Cache a component or a part of a
component on Archive Cache Server” on page 52
• “dshCsFlush: Remove a component or an entire document from Archive
Cache Server” on page 54
30 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
2.3. libdsh library
The *File functions read appropriate information from a file, whereas the other
functions read them directly from a memory buffer, which is safer especially for
the private key, but complicates the configuration of several clients.
• Your application should also set two further parameters, a unique authentication
ID (client ID) and an expiry time period, which defines how long a SecKey is valid
after it is received on the server. These parameters are necessary to build correct
SecKeys. If you do not specify them, libdsh will use default values (see below).
• Use dshSetAuthId for setting the authentification ID (client ID) of the
respective client. The ID must exactly match the ID listed in the digital
certificate. If you do not set this ID, libdsh uses the client host name as
authentication ID. dshSetAuthId is described in “dshSetAuthId: Set
authenticity” on page 178.
• Use dshSetExpTimeSecKey to set the expiry time period. If you do not set
this value, libdsh will use the default value, 3600 s (1 hour).
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 31
AR100500-PSA-EN-3
Chapter 2 Concepts and basics
Once these settings are in place, libdsh automatically builds and uses the SecKey
whenever necessary; you need no longer care for this subject then.
2.3.3.1 Logging
Logging to file Before you initialize a libdsh session, you should decide whether error messages
should be written to the STDERR stream (default) or whether you want to redirect
STDERR to a log file. If you want to use a log file, specify the path and file name of the
log file via the dshSetLogFile function. Moreover, you should specify a maximum
size for the log file (dshSetLogMaxSize). As soon as the size of the log file exceeds the
maximum, libdsh renames the log file to <log_file>.sav and creates a new, empty
<log_file> for logging (if there is an older <log_file>.sav file, it will be removed).
Log channels With the dshSetLogLevel function, you can specify, which messages should be
logged at all. libdsh distinguishes three log channels, that can be activated by this
function:
Important
As STDERR is redirected to the log file, all messages written to STDERR are
written to this file, even if they are generated by your application.
Notes
32 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
2.3. libdsh library
Communication As part of the dsh object creation, a connection to the repository server is established
session and a communication session is set up (Because this is the main purpose of the dsh
object, the following refers to the session rather than to the abstract object).
Parameters The parameters used in the function call have the following meaning:
secondary_host
Hostname of a second server to be addressed by the library if the primary server
is not available. Specify NULL if no second server is available. This second server
can be a replication server, for example (see “Servers, clients, leading
application” on page 11).
protocol
Either HTTP or HTTPS, depending on the protocol you want to use.
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 33
AR100500-PSA-EN-3
Chapter 2 Concepts and basics
No automatic storage
This means:
• You must trigger their storage before you call up the dshClose() or
dshExit function, respectively (see below).
• When you begin the next session, you must cause your application to
read the respective configuration file.
Some settings Note that some settings applied via a libdsh function are assigned to a specific
are session, for example, the application name, user name, refresh time or SecKey
session‑specific
...
expiration time. Such a session is opened by dshOpen and closed by dshClose()
(not by dshExit!), and during the session, it is referenced by the dsh class handle in
the function parameters. This assignment implies two consequences if you should
happen to open more than one session at a time:
• Local settings must be specified in each of these sessions.
• The settings may differ for different repository servers and then require an
individual storage mechanism for each session (server); the values must be
stored, before dshClose is called.
... others are Other settings apply to all sessions, as they are assigned to the superordinated
global. libdsh object. They are initiated at the first dshOpen call and are available until
dshExit is called. This applies to the following settings:
34 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
2.3. libdsh library
Initial values via For most settings, you can specify an initial value via corresponding environment
environment variables (see “Global environment variables” on page 228). Depending on the
variables
scope of the settings, the point at which the initialization takes place, differs:
• Settings for logging are initialized when the first dshLog* function is called.
• Session-specific settings are initialized when the session is established via
dshOpen.
• All other settings are initialized at the first dshOpen call only.
Notes
• An error handler can only recognize errors that were foreseeable by the
development team. Therefore an error may occur (i.e. a function call returns
the value 0 or NULL, respectively), but dshGetLastError and
dshGetLastErrno do not recognize the error and return 0/NULL, too (“No
error information available”). A few situations of this kind were detected
during testing the software and are described then in the respective function
sections (dshGetUser).
Note that some functions do not return a value, because no error conditions
are anticipated; this applies in particular to the dshSet* functions (see also
“Function parameters and return values” on page 36).
• dshGetLastError and dshGetLastErrno can only be used for functions
related to a certain session, as the error information itself is assigned to a
session. Therefore, these functions cannot provide information on errors that
have occurred when calling dshOpen, dshSetLogFile, dshSetLogLevel,
dshSetLogMaxSize.
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 35
AR100500-PSA-EN-3
Chapter 2 Concepts and basics
Return value The return value always serves as an error indicator. If the function returns the value
0 or NULL, the function has failed, and you can get further information on the error
by calling the dshGetLastError or dshGetLastErrno function.
If successful, some functions return the requested data via the return value, others
return it via one or several parameters. This differs from function to function.
Note: The following functions do not provide a return value at all: All dshSet*
functions (except dshDsSetAttribute), dshClose, dshExit, dshFree,
dshGetVersion, dshClearLastError.
Allocation As a rule, you need not allocate memory for data or strings to be returned via a
before func- function return value. If strings or data are returned via function parameters, some
tion call
functions require that you allocate sufficient memory before calling the function,
others do not. See the respective function descriptions in “libdsh function reference“
on page 37 for details, in this case.
Freeing If a function itself has allocated memory for its return value or for a value returned
allocated by the parameters, you must release that memory buffer using the dshFree function.
memory
Do not use the standard free function here, as this may cause problems due to the
ownership of the memory buffer.
Case-sensitive! Note that most functions are case-sensitive, especially when you specify document
or component names or attributes. In the search functions (dshDsSearch,
dshDsAttrSearch), you can specify whether the search should be case-sensitive or
not.
36 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
Chapter 3
libdsh function reference
This chapter provides a reference of all functions available in libdsh. These functions
are listed in alphabetical order.
Notes
• “Grouped function list” on page 28 provides another overview of the libdsh
functions, grouped by functionality.
• All function names in the libdsh client library start with “dsh”. Functions
with a name starting with “dshDs” directly access the Document Service on
Archive Server. Others are either internal functions of libdsh that do not
access the server at all (to set or retrieve configuration parameters, for
example), or they combine a call to the server with some internal
functionality.
• See “Function parameters and return values” on page 36 for common
information on how to deal with function parameters and return values.
The functions are described in a formal way, according to the following pattern:
• Purpose describes the meaning of the function and maybe special items which
you may not otherwise expect.
• Function header tells you how to call the function and what type the parameters
are.
• Parameters then provides detailed information on the individual parameters (for
example, their meaning, and whether you must specify a value (input), or
whether the parameter returns a value (output), or both).
• Return values tells you which values can be returned by the function itself, in
addition to the values that may be returned by some parameters. Usually, this
value is 0 or NULL if an error has occurred (see below), or the requested result, if
the function has been completed successfully.
• Errors that may occur provides a list of all errors that can cause this function to
break down. This enables you to check only the potential errors after calling a
function, in order to keep the error handler smaller and more precise.
• SecKey access mode tells you which access mode is assigned to the function, if the
logical archive hosting the document is protected via SecKeys; see “Access
protection via SecKeys (signed URLs)” on page 22.
• Example provides an example of calling the function; it is sometimes embedded
in a larger piece of code.
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 37
AR100500-PSA-EN-3
Chapter 3 libdsh function reference
• Related functions lists those functions that are more or less directly related to the
described function. However, such a list depends on the context, in which a
function is used; therefore it may not be complete at times. In such a case, consult
“Grouped function list” on page 28 which lists the functions grouped by their
functionality.
38 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
3.1. dshClearLastError: Clear last error message
Function Header
void dshClearLastError(void *dsh);
Parameters
• dsh (input)
Class handle, obtained via a preceding dshOpen() call.
Return values
No return values
Example
Related Functions
• “dshGetLastErrno: Get error number” on page 148
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 39
AR100500-PSA-EN-3
Chapter 3 libdsh function reference
Notes
• Call dshClose() at the end of your program or when you no longer
need the connection to Archive Server. Only a dshExit must follow in
order to free all memory and resources allocated by the library.
• If you opened several connections to different repository servers, call
dshClose for each of them, before you call dshExit.
• Local settings get lost!
If you want to reuse local settings that you applied during this session,
you must store them before calling dshClose (see “Setting parameters”
on page 34 for details).
Function Header
void dshClose(void *dsh);
Parameters
• dsh (input)
class handle, obtained via a preceding dshOpen() call.
Return values
No return values
Example
See the examples in “Archive Server API in practice“ on page 193
Related Functions
• “dshOpen, dshOpen2: Open connection to repository server” on page 170
• “dshExit: Exit the libdsh library” on page 127
40 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
3.3. dshCompInfo: Get information on (unknown) components
Notes
• In particular, dshDsInfo() and dshCompInfo serve to obtain the names
of components in a document the structure of which you do not know. If
you want to retrieve information on a component the name of which you
do know, the dshGetCompStatus function is faster and more efficient
than dshCompInfo.
• To retrieve information on a document (in particular, the number of
components), use the dshGetDocInfo function.
• If you no longer need the info string, call dshFree() to free the
respective memory buffer (but be careful not to use the info pointer
here).
• dshCompInfo replaces the dshCompInfoStatus function that therefore is
deprectaed now. Note that order and naming of the parameters in
dshCompInfo is different, and that the parameters need no memory
allocation any longer.
Function Header
int dshCompInfo(
void *dsh,
char **info,
int utc_flag,
char **name,
char **status,
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 41
AR100500-PSA-EN-3
Chapter 3 libdsh function reference
char **type,
char **c_date,
char **c_time,
char **m_date,
char **m_time,
char **length,
int *version,
char **vol_name,
char **sig_object);
Parameters
• dsh (input)
Class handle, obtained via a preceding dshOpen() call.
• info (in/out)
Info string obtained via a preceding dshDsInfo() call. See Purpose above for
details.
• utc_flag (input)
Specify 0 to get date and time in localtime.
Specify 1 to get date and time in UTC (Greenwich time).
• name (output)
Component name
• status (output)
Document/component status, which may be one of the following values:
online, offline, unknown, error. error means that no further components
are listed in the info string.
• type (output)
File type of the component (see “Document/component formats (renditions,
file types)” on page 19)
• c_date (output)
Date when the component has (initially) been stored in the archive; format:
YYYYMMDD
• c_time (output)
Time when the component has (initially) been stored in the archive; format:
HHMMSS
• m_date (output)
Date of the most recent modification of the document that contains the
component; format: YYYYMMDD
• m_time (output)
Time of the most recent modification of the document that contains the
component; format: HHMMSS
• length (output)
Size of component in byte (-1 if size is unknown)
• version (output)
42 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
3.3. dshCompInfo: Get information on (unknown) components
Return values
1: Function completed successfully.
2: No more components are listed in the info string.
0: Error; use the dshGetLastErrno function to obtain further error information
For an overview of all error messages, see “libdsh errors” on page 234.
SecKey access mode
Requires read access permission for the document on the repository server.
Example
• Get status information of first component of document d1 in archive A1:
char *name, *status, *type, *c_date, *c_time, *m_date,
*m_time, *length, *vol_name, *sig_object;
int *version;
char *info = dshDsInfo(dsh,"A1","d1","");
char *save_info = info;
int ret = dshCompInfo(dsh,&info,0, &name, &status,
&type, &c_date, &c_time, &m_date,
&m_time, &length, &version,
&vol_name, &sig_object);
dshFree(save_info);
...
Note that dshFree() needs also be called for the function parameters after
their evaluation.
• Get status information of all components of document d1 in archive A1:
char *name, *status, *type, *c_date, *c_time, *m_date,
*m_time, *length, *vol_name, *sig_object;
[1] If a component is modified using DsUpdate*, a version counter for this component is increased. This
version counter is returned here.
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 43
AR100500-PSA-EN-3
Chapter 3 libdsh function reference
int version;
char *info = dshDsInfo(dsh,"A1","d1","");
char *save_info = info;
int ret;
while ( (ret=dshCompInfo(dsh,&info,0, &name, &status,
&type, &c_date, &c_time, &m_date,
&m_time, &length, &version,
&vol_name, &sig_object) == 1 ) {
printf("component=%s, length=%s\n",name,length);
dshFree(name);
dshFree(status);
dshFree(type);
dshFree(c_date);
dshFree(c_time);
dshFree(m_date);
dshFree(m_time);
dshFree(length);
dshFree(vol_name);
dshFree(sig_object);
}
dshFree(save_info);
if ( ret == 0 ) {
printf("Error in getting component info\n");
}
Note that the info string stored in save_info contains the information on all
components in both examples. The only difference is that the first example
evaluates only the first information set within the string, whereas the while
loop in the second example iteratively steps through the whole info string
and returns the information on all components.
Related Functions
• “dshDsInfo: Get info string for document/Component” on page 86
• “dshGetCompStatus: Get information on component” on page 136
• “dshCompInfoStatus [DEPRECATED]:
Get information on (unknown) components” on page 45
• “dshDsMigrate, dshDsMigrate2: Migrate document to another logical
archive or pool” on page 89
44 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
3.4. dshCompInfoStatus [DEPRECATED]: Get information on (unknown) components
Notes
• Note that you must allocate sufficient memory for most parameters
before you call the function.
• In particular, dshDsInfo() and dshCompInfoStatus serve to obtain the
names of components in a document whose structure you do not know.
If you want to retrieve information on a component whose name you do
know, the dshGetCompStatus function is faster and more efficient than
dshCompInfoStatus.
• To retrieve information on a document (in particular, the number of
components), use the dshGetDocInfo function.
• If you no longer need the info string, call dshFree() to free the respective
memory buffer (but be careful not to use the info pointer here).
Function Header
int dshCompInfoStatus(
void *dsh,
char **info,
char *compid,
char *status,
char *type,
char *ar_date,
char *ar_time,
char *size,
int utc_flag
);
Parameters
• dsh (input)
Class handle, obtained via a preceding dshOpen() call.
• info (in/out)
Info string obtained via a preceding dshDsInfo() call. See Purpose for
details.
• compid (output)
Component name
Must be allocated by the calling application with a size >= 100 bytes.
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 45
AR100500-PSA-EN-3
Chapter 3 libdsh function reference
• status (output)
Document/component status, which may be one of the following values:
ONLINE, OFFLINE, UNKNOWN, ERROR. ERROR means that no further components
are listed in the info string.
Must be allocated by the calling application with a size >= 21 bytes.
• type (output)
File type of the component (see “Document/component formats (renditions,
file types)” on page 19).
Must be allocated by the calling application with a size >= 41 bytes.
• ar_date (output)
Modification date, i.e. date when the document containing the component
has been modified most recently; format: YYYYMMDD.
Must be allocated by the calling application with a size = 9 bytes.
• ar_time (output)
Modification time, i.e. time when the document containing the component
has been modified most recently; format: HHMMSS.
Must be allocated by calling application with a size = 7 bytes.
• size (output)
Size of component in byte (-1 if unknown)
Must be allocated by calling application with a size > =14 bytes.
• utc_flag (input)
Specify 0 to get date and time in localtime.
Specify 1 to get date and time in UTC (Greenwich time).
Return values
1: Function completed successfully.
2: No more components are listed in the info string. The status parameter is set
to ERROR (however, this is not a libdsh error and thus cannot be investigated via
dshGetLastErrno or dshGetLastError).
0: Error; use the dshGetLastErrno function to obtain further error information
For an overview of all error messages, see “libdsh errors” on page 234.
SecKey access mode
Requires read access permission for the document on the repository server.
Example
• Get status information of first component of document d1 in archive A1:
char compid[100], status[21], type[41], ar_date[9],
ar_time[7], size[14];
46 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
3.4. dshCompInfoStatus [DEPRECATED]: Get information on (unknown) components
Note that the info string stored in save_info contains the information on all
components in both examples. The only difference is that the first example
evaluates only the first information set within the string, whereas the while
loop in the second example iteratively steps through the whole info string
and returns the information on all components.
Related Functions
• “dshDsInfo: Get info string for document/Component” on page 86
• “dshGetCompStatus: Get information on component” on page 136
• “dshCompInfo: Get information on (unknown) components” on page 41
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 47
AR100500-PSA-EN-3
Chapter 3 libdsh function reference
Archive ID
Name of the logical archive
Host name
Name of the server to be used for addressing the logical archive
Only in an archive-centric system, this parameter specifies Archive Server
where the logical archive actually is located; otherwise, this parameter
contains Archive Server that is the communication partner for the client.
Server type
either “O”=Orignal or “R”=Replicate
SSL mode
• ssl_off
SSL is not allowed.
• ssl_on
SSL is mandatory.
• ssl_allow
SSL is allowed but not mandatory.
PROT_READ = 0x001
PROT_CREATE = 0x002
PROT_UPDATE = 0x004
PROT_DELETE = 0x008
HTTP port
The HTTP port as a number
[2] This applies only if pretty_print_flag==0; do not use pretty_print_flag==1.
48 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
3.5. dshDsAdmInfo2: Get information about archives
HTTPS port
The HTTPS port as a number
Archive Path
Part of the URL specifying the addressed server, including the leading slash.
Note: Use this string just to verify whether two logical archives are
located on the same Archive Server; do not use it as an identifier for
the respective Archive Server, as its generation can be arbitrary and the
value can change between two software versions.
This parameter is intended primarily for the use within migration
scenarios using the dshDsMigrate* functions.
Storage tiers
List of all storage tiers, surrounded by curly brackets and separated by space
characters.
Notes
• Call dshFree() to free the memory buffer allocated for the function
return value.
Function Header
char *dshDsAdmInfo(
void *dsh,
int now_flag,
int pretty_print_flag
);
Parameters
• dsh (input)
Class handle, obtained by a preceding dshOpen() call.
• now_flag (input)
The list of available Archive Servers is loaded from the ADMS periodically
and stored in a local cache; now_flag specifies where to read the list from:
• Specify 0 to read the data from the cache (prefered value in nearly every
case).
• Specify 1 to obtain the most recent information directly from the ADMS.
This also updates the internal cache and resets the counter that triggers
the next automatic update (AidRefreshTime).
• pretty_print_flag (input)
• Specify 0 for getting the original message string assembled by the ADMS.
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 49
AR100500-PSA-EN-3
Chapter 3 libdsh function reference
If you parse the result of this call in an automated way, always specify 0
here.
Return values
Information string on success (see Purpose above).
NULL on error.
For an overview of all error messages, see “libdsh errors” on page 234.
Examples for returned strings:
• String returned from an Archive Server Version lower than 9.7:
50 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
3.5. dshDsAdmInfo2: Get information about archives
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 51
AR100500-PSA-EN-3
Chapter 3 libdsh function reference
Function Header
char *dshCsCache(
void *dsh,
const char *aid,
const char *docid,
const char *compid
);
char *dshCsCachePart(
void *dsh,
const char *aid,
const char *docid,
const char *compid
int64_t char from_offset,
int64_t char to_offset,
const char *permanent
);
Parameters
• dsh (input)
Class handle, obtained by a preceding dshOpen() call.
• aid (input)
Name of the logical archive where the component to be cached resides
• docid (inputt)
ID of the document containing the component to be cached
• compid (input)
Component name of the componentn to be cached
If an empty string is specified, the component names “data” is taken.
• from_offset (input, dshCsCachePart only)
Byte offset of the beginning of the part to be cached (0 = start of component)
• to_offset (input, dshCsCachePart only)
Byte offset of the end of the part to be cached (-1 = part ends at the end of the
component)
• permanent (input, dshCsCachePart only)
optional flag for future use
52 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
3.6. dshCsCache, dshCsCachePart: Cache a component or a part of a component on
Archive Cache Server
Return values
1: Function completed successfully.
2: Error: No cache server available.
0: Error; use the dshGetLastErrno function to obtain further error information
For an overview of all error messages, see “libdsh errors” on page 234.
Examples
• Cache component c1 of document d1 of archive A1 on the Archive Cache
Server:
or
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 53
AR100500-PSA-EN-3
Chapter 3 libdsh function reference
Parameters
• dsh (input)
Class handle, obtained by a preceding dshOpen() call.
• aid (input)
Name of the logical archive (on Archive Server) where the cached
component resides
• docid (inputt)
ID of the document containing the cached component
• compid (input)
Component name of the componentn to be cached
If an empty string or NULL is specified, the entire document is removed from
the Cache Server.
Return values
1: Function completed successfully.
2: Error: No cache server available.
0: Error; use the dshGetLastErrno function to obtain further error information
54 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
3.7. dshCsFlush: Remove a component or an entire document from Archive Cache Server
For an overview of all error messages, see “libdsh errors” on page 234.
Examples
• Remove component c1 of document d1 of archive A1 from the Archive Cache
Server:
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 55
AR100500-PSA-EN-3
Chapter 3 libdsh function reference
Important
Do not modify composed documents (form overlay, notes,
annotations)
libdsh does not support composed documents, for example, form
overlays, notes or annotations. Therefore you should not modify or
replace components in a document using form overlays, notes or
annotations, as this may impact the structural relationship between the
individual components, and may destroy the document (see also
“Document model” on page 14).
Function Header
int dshDsAppendData(
void *dsh,
const char *aid,
const char *docid,
const char *compid,
char *data,
long size
);
int dshDsAppendFile(
void *dsh,
const char *aid,
const char *docid,
const char *compid,
const char *path
);
Parameters
• dsh (input)
Class handle, obtained via a preceding dshOpen() call.
• aid (input)
Archive name
• docid (input)
Document ID
• compid (input)
Component name
• data (input)
Memory buffer with data for appending
56 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
3.8. dshDsAppendData, dshDsAppendFile: Append to a component
• size (input)
Number of bytes of the data memory buffer to be appended to the compid
component (may be smaller than the real size of the buffer)
• path (input)
Local filename that should be appended to component compid
Return values
1: Function completed successfully.
0: Error; use the dshGetLastErrno function to obtain further error information.
For an overview of all error messages, see “libdsh errors” on page 234.
SecKey access mode
Requires change access permission for the document on the server.
Example
Append the contents of a file x.txt to the component c1 of a document d1,
which is located in the A1 archive:
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 57
AR100500-PSA-EN-3
Chapter 3 libdsh function reference
See also “dsh_append example: Append data to an archived file” on page 206
Related Functions
• “dshDsCreate*, dshDsCreateFile*: Create document/Component”
on page 64
• “dshDsLock: Lock document” on page 92
58 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
3.9. dshDsAttrSearch, dshDsAttrSearch2: Search in SAP print list
Figure 3-1: Each DAIN line represents a complete attribute set; within this
set, each attribute can be uniquely addressed by its local offset and its
string length.
Within each DAIN line, a certain attribute can be addressed by its offset, starting
at the beginning of the line, and by its length. The structure of the DAIN lines is
specified in a preceding set of DKEY lines; it is fixed for all DAIN lines succeeding
the DKEY line set (see Figure 3-1). Each DKEY line represents one attribute in the
DAIN lines, specifying the attribute name, its offset in the DAIN line and its
length.
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 59
AR100500-PSA-EN-3
Chapter 3 libdsh function reference
In Archive Server, both the print list itself and its description file are stored as
two components of the same document: The full print list is stored in the data
component, and the description file is stored in the descr component.
Notes
• For more information on print lists and their description files, see the
ArchiveLink 4.5 documentation by SAP (reference [1] in “Further
information sources” on page 225)
• Do not confuse the printlist attributes described above and the document
attributes of archive documents as described in “Document model”
on page 14.
• The only difference between two functions is the type assignment of the
parameters from_offset and to_offset.
Search pattern
The dshDsAttrSearch function exclusively searches in the attribute values (the
DAIN lines) of the description file of a print list. The search pattern handed over
in the pattern parameter must be structured as follows:
<offset>+<length>+<stringpattern>
If you want to search in all attributes of the description file, specify <offset> = 0
and the full length of the DAIN lines (which can be excerpted from the DKEY line
immediately preceding the DAIN lines). By specifying an offset > 0 and an
explicit length, you may restrict the search to a certain attribute or several
adjacent attributes. If you want to search in several attributes, that are not
neighbors, specify several patterns and concatenate them separated by a “#” (see
also Example below).
Search result
The search result consists of the number of hits and the offset and length for
each hit. The values are separated by semicolons, and the string ends with a
semicolon:
<number of hits(= n)>; <offset of hit 1>; <length of hit 1>; ...; <offset of
hit n>; <length of hit n>;
Note: Call dshFree() to free the memory buffer that has been allocated for
the returned attribute string.
Function Header
char *dshDsAttrSearch(
void *dsh,
const char *aid,
const char *docid,
const char *pattern,
long from_offset,
long to_offset,
int num_results,
int case_sensitive
);
60 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
3.9. dshDsAttrSearch, dshDsAttrSearch2: Search in SAP print list
char *dshDsAttrSearch2(
void *dsh,
const char *aid,
const char *docid,
const char *pattern,
int64_t from_offset,
int64_t to_offset,
int num_results,
int case_sensitive
);
Parameters
• dsh (input)
Class handle, obtained via a preceding dshOpen() call.
• aid (input)
Archive name
• docid (input)
Document ID
• pattern (input)
Search pattern
• from_offset (input)
Offset in print list (data component) to start search
Return values
Search result on success, see Purpose above.
“0;:” No hits were found.
NULL: Error; use the dshGetLastErrno function to obtain further error
information.
Errors that may occur
• DSH_ERR_HTTP_EMPTY_RESULT (11002):
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 61
AR100500-PSA-EN-3
Chapter 3 libdsh function reference
For an overview of all error messages, see “libdsh errors” on page 234.
SecKey access mode
Requires read access permission for the document on the server
Example
• Example for a search pattern:
By specifying pattern="15+25+GmbH" you search for “GmbH” in the
attribute which starts at offset 15 of each DAIN line and is 25 characters long.
• Example for a return string:
2;73;138;211;120; means that two hits were found; the first hit starts at
offset 73 with length 138, and the second hit starts at offset 211 with length
120. If no matching attribute was found, the function returns 0;.
• Example for a function call:
The term “GmbH” is searched for in a component in the attribute with offset
15 and length 25 in document d1 in archive A1. The search must be case-
sensitive:
62 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
3.9. dshDsAttrSearch, dshDsAttrSearch2: Search in SAP print list
...
dshFree(retstring);
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 63
AR100500-PSA-EN-3
Chapter 3 libdsh function reference
Notes
• You may also specify a Document ID that does not yet exist on the
server. Then a document with this ID is generated, and the component is
stored in this document. This allows you to define Document IDs
according to your own scheme; on the other hand, it is your
responsibility then to ensure that all Document IDs are unique in the
entire archive (see also “Document ID” on page 14).
• If you need the Document ID of a document even before you store it in
the archive, use the dshDsReserveDocId function to reserve a Document
ID.
• Note that the first component usually is interpreted as the main
component (see “Main component” on page 15). Therefore, always store
the main component at first.
Function Header
int dshDsCreate(
void *dsh,
const char *aid,
char *docid,
const char *compid,
const char *type,
char *data,
long size,
const char *app_type
);
int dshDsCreate2(
void *dsh,
const char *aid,
64 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
3.10. dshDsCreate*, dshDsCreateFile*: Create document/Component
char *docid,
const char *compid,
const char *type,
char *data,
long size,
const char *app_type
const char *timestamp,
const char *retention_period,
const char *store_param
);
int dshDsCreate3(
void *dsh,
const char *aid,
char *docid,
const char *compid,
const char *type,
char *data,
long size,
const char *app_type
const char *timestamp,
const char *retention_period,
const char *store_param
const char *storage_tier
);
int dshDsCreate4(
void *dsh,
const char *aid,
char *docid,
const char *compid,
const char *type,
char *data,
long size,
const char *app_type,
const char *timestamp,
const char *retention_period,
const char *store_param,
const char *storage_tier,
const char *token);
int dshDsCreateFile(
void *dsh,
const char *aid,
char *docid,
const char *compid,
const char *type,
const char *path,
const char *app_type
);
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 65
AR100500-PSA-EN-3
Chapter 3 libdsh function reference
int dshDsCreateFile2(
void *dsh,
const char *aid,
char *docid,
const char *compid,
const char *type,
const char *path,
const char *app_type
const char *timestamp,
const char *retention_period,
const char *store_param
);
int dshDsCreateFile3(
void *dsh,
const char *aid,
char *docid,
const char *compid,
const char *type,
const char *path,
const char *app_type
const char *timestamp,
const char *retention_period,
const char *store_param
const char *storage_tier
);
int dshDsCreateFile6(
void *dsh,
const char *aid,
char *docid,
const char *compid,
const char *type,
const char *path,
const char *app_type
const char *timestamp,
const char *retention_period,
const char *store_param
const char *storage_tier
const char *rms,
const char *token,
char **comp_info);
Parameters
• dsh (input)
Class handle, obtained via a preceding dshOpen() call.
• aid (input)
Archive name
• docid (in/out)
66 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
3.10. dshDsCreate*, dshDsCreateFile*: Create document/Component
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 67
AR100500-PSA-EN-3
Chapter 3 libdsh function reference
Return values
1: Function completed successfully.
0: Error; use the dshGetLastErrno function to obtain further error information
68 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
3.10. dshDsCreate*, dshDsCreateFile*: Create document/Component
HTTP error (Internal Server Error [500]): Internal error in archive server
• DSH_ERR_HTTP_CONNECTION_BROKEN (11003):
HTTP error: connection was broken
• DSH_ERR_HTTP_UNKNOWN (11004):
HTTP error: unknown error
For an overview of all error messages, see “libdsh errors” on page 234.
Example
Append the file x.txt as a new component c1 of type application/x-otf to
the d1 document in archive A1:
See also “dsh_put example: Archiving files in a single document” on page 199
Related Functions
• “dshDsAppendData, dshDsAppendFile: Append to a component”
on page 56
• “dshDsLock: Lock document” on page 92
• “dshDsUpdate*, dshDsUpdateFile*: Update component” on page 112
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 69
AR100500-PSA-EN-3
Chapter 3 libdsh function reference
Notes
• In an OpenText TCP system (context server), the access to an attribute
must be enabled via the Server Configuration.
• Do not delete the type attribute, as it is used internally by the server. Of
course, you also should not delete variables defined by other
applications, unless you are sure that they are no longer needed.
Function Header
int dshDsDelAttribute(
void *dsh,
const char *aid,
const char *docid,
const char *compid,
const char *attribute
);
Parameters
• dsh (input)
Class handle, obtained via a preceding dshOpen() call.
• aid (input)
Archive name
• docid (input)
Document ID
• compid (input)
Component name; specify "" to delete a document attribute instead of a
component attribute.
• attribute (input)
Attribute name
Return values
1: Function completed successfully.
0: Error; use the dshGetLastErrno function to obtain further error information.
70 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
3.11. dshDsDelAttribute: Delete attribute
• DSH_ERR_UNKNOWN_ARCHIVE (11206):
Unknown archive
• DSH_ERR_HTTP_400 (11005):
HTTP error (bad request [400]): Unknown function or parameter
• DSH_ERR_HTTP_401 (11006):
HTTP error (unauthorized [401]): Breach of security
• DSH_ERR_HTTP_404_DELA (11016):
HTTP error (not found [404]): Either the document, the component or the
attribute does not exist
• DSH_ERR_HTTP_500 (11012):
HTTP error (Internal Server Error [500]): Internal error in archive server
• DSH_ERR_HTTP_CONNECTION_BROKEN (11003):
HTTP error: connection was broken
• DSH_ERR_HTTP_UNKNOWN (11004):
HTTP error: unknown error
For an overview of all error messages, see “libdsh errors” on page 234.
Example
Delete the author attribute of component c1 in document d1, located in the A1
archive:
Related Functions
• “dshDsSetAttribute: Set attribute” on page 105
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 71
AR100500-PSA-EN-3
Chapter 3 libdsh function reference
Important
Use this function with care: Once you apply dshDsDelete to a document
or component, it will be permanently deleted! There is no undo option
for dshDsDelete (or for any libdsh function).
Parameters
• dsh (input)
Class handle, obtained via a preceding dshOpen() call.
• aid (input)
Archive name
• docid (input)
Document ID
• compid (input)
72 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
3.12. dshDsDelete, dshDsDelete2: Delete document/Component
Component name
• token (input)
Allows for a short period of time to delete any document even if retention is
not yet expired. Used for cleaning up created documents in a transactional
manner. See dshDsCreate calls for more information on parameter token.
Parameter is ignored if NULL pointer or "".
Return values
1: Function completed successfully.
0: Error; use the dshGetLastErrno function to obtain further error information.
• DSH_ERR_ACCESS_FILE (11207):
Error in accessing file
• DSH_ERR_UNKNOWN_ARCHIVE (11206):
Unknown archive
• DSH_ERR_HTTP_400 (11005):
HTTP error (bad request [400]): Unknown function or parameter
• DSH_ERR_HTTP_401 (11006):
HTTP error (unauthorized [401]): Breach of security
• DSH_ERR_HTTP_404 (11008):
HTTP error (not found [404]): Document/component/archive not found
• DSH_ERR_HTTP_409 (11010):
HTTP error (conflict [409]): Document/component/administrat. data is
inaccessible
• DSH_ERR_HTTP_500 (11012):
HTTP error (Internal Server Error [500]): Internal error in archive server
• DSH_ERR_HTTP_CONNECTION_BROKEN (11003):
HTTP error: connection was broken
• DSH_ERR_HTTP_UNKNOWN (11004):
HTTP error: unknown error
For an overview of all error messages, see “libdsh errors” on page 234.
Example
Delete component c1 of document d1 in archive A1:
Related Functions
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 73
AR100500-PSA-EN-3
Chapter 3 libdsh function reference
74 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
3.13. dshDsGet*, dshGetFile*, dshDsGetPart*: Get component
If compid is set to "", the data component is read (data is the default name for
components in Archive Server)
Note: Call dshFree() to free the memory buffer that has been allocated for
the returned data element (not in dsh).
Function Header
int dshDsGet(
void *dsh,
const char *aid,
const char *docid,
const char *compid,
char **data,
int *size
);
int dshDsGet2(
void *dsh,
const char *aid,
const char *docid,
const char *compid,
char **data,
int *size
const char *rms,
const char *origid
);
int dshDsGetFile(
void *dsh,
const char *aid,
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 75
AR100500-PSA-EN-3
Chapter 3 libdsh function reference
76 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
3.13. dshDsGet*, dshGetFile*, dshDsGetPart*: Get component
int length,
char **data,
int *size
const char *rms,
const char *origid
);
Parameters
• dsh (input)
Class handle, obtained via a preceding dshOpen() call.
• aid (input)
Archive name
• docid (input)
Document ID
• compid (input)
Component name
• offset (input)
Offset in compid where reading should start (The byte with this offset is the
first byte to be returned)
• length (input)
Number of bytes of component compid to be read
• data (output)
Data (contents) of the requested component
• size (output)
Size of data
• path (input)
Path and name of the local destination file where the contents of the
component compid shall be stored.
• rms (input; dshDsGet2, dshDsGetPart3, dshDsGetFile2, dshDsGetFile3
only)
Access token for Rights Management Services (RMS). For internal use only –
set to NULL.
• origid (input; dshDsGet2, dshDsGetPart3, dshDsGetFile3 only)
Originator of request. Set to "" or NULL if not used.
Return values
1: Function completed successfully.
0: Error; use the dshGetLastErrno function to obtain further error information
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 77
AR100500-PSA-EN-3
Chapter 3 libdsh function reference
Unknown archive
• DSH_ERR_HTTP_400 (11005):
HTTP error (bad request [400]): Unknown function or parameter
• DSH_ERR_HTTP_401 (11006):
HTTP error (unauthorized [401]): Breach of security
• DSH_ERR_HTTP_404 (11008):
HTTP error (not found [404]): Document/component/archive not found
• DSH_ERR_HTTP_409 (11010):
HTTP error (conflict [409]): Document/component/administrat. data is
inaccessible
• DSH_ERR_HTTP_500 (11012):
HTTP error (Internal Server Error [500]): Internal error in archive server
• DSH_ERR_HTTP_CONNECTION_BROKEN (11003):
HTTP error: connection was broken
• DSH_ERR_HTTP_UNKNOWN (11004):
HTTP error: unknown error
• DSH_ERR_HTTP_560_ONTAPE
HTTP error (document not accessible [560]): The document cannot be
accessed because it is on tape.
For an overview of all error messages, see “libdsh errors” on page 234.
Example
Get component c1 of document d1 in archive A1 and store its contents in the
local file x.txt:
Related Functions
• “dshDsCreate*, dshDsCreateFile*: Create document/Component”
on page 64
78 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
3.14. dshDsGetATS: Get evidence record of a component
Note: Call dshFree() to free the memory buffer that has been allocated for
the returned evidence record.
Function Header
char *dshDsGetAttribute(
void *dsh,
const char *aid,
const char *docid,
const char *compid,
const char *hash_alg
const char *vol_name
const char **data
const char *size
);
Parameters
• dsh (input)
Class handle, obtained via a preceding dshOpen() call.
• aid (input)
Archive name
• docid (input)
Document ID
• compid (input)
Component name
• hash_alg (input)
Hash algorithm. If an empty string or NULL is specified, the default SHA1 is
used.
• vol_name (input, optional)
Name of the volume where the document is stored. This is helpful to find the
document faster in case the document is stored on an offline medium and the
leading application has stored the volume information.
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 79
AR100500-PSA-EN-3
Chapter 3 libdsh function reference
Return values
1: Function completed successfully.
0: Error; use the dshGetLastErrno function to obtain further error information.
Example
Get the evidence record of component c1 of document d1 of archive A1:
char *data;
int size;
int ret = dshDsGetATS(dsh,"A1","d1","c1","","", &data,&size);
…
dshFree(data);
Related Functions
• “dshDsVerifySig: Proof timestamp of a component” on page 124
80 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
3.15. dshDsGetAttribute: Get attributes
Notes
• If you operate in an OpenText TCP system, but want to keep the
attribute naming as used in archive-centric systems, a name mapping
must be defined via the Server Configuration.
• Call dshFree() to free the memory buffer that has been allocated for the
returned attribute string.
Function Header
char *dshDsGetAttribute(
void *dsh,
const char *aid,
const char *docid,
const char *compid,
const char *attribute
);
Parameters
• dsh (input)
Class handle, obtained via a preceding dshOpen() call.
• aid (input)
Archive name
• docid (input)
Document ID
• compid (input)
Component name. Specify "" if you want to retrieve the attribute(s) of a
document.
• attribute (input)
Attribute name (case sensitive!). Specify "" if you want to retrieve all
attributes of a component or document
Return values
Requested attribute(s) on success, see Purpose above.
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 81
AR100500-PSA-EN-3
Chapter 3 libdsh function reference
NULL: Specified attribute was not found or another error occurred; use the
dshGetLastErrno function to obtain further error information.
• DSH_ERR_HTTP_EMPTY_RESULT (11002):
Wrong (empty) result from archive server
• DSH_ERR_ACCESS_FILE (11207):
Error in accessing file
• DSH_ERR_UNKNOWN_ARCHIVE (11206):
Unknown archive
• DSH_ERR_HTTP_400 (11005):
HTTP error (bad request [400]): Unknown function or parameter
• DSH_ERR_HTTP_401 (11006):
HTTP error (unauthorized [401]): Breach of security
• DSH_ERR_HTTP_404_GETA (11015):
HTTP error (not found [404]): Either the document, the component or the
attribute does not exist
• DSH_ERR_HTTP_500 (11012):
HTTP error (Internal Server Error [500]): Internal error in archive server
• DSH_ERR_HTTP_CONNECTION_BROKEN (11003):
HTTP error: connection was broken
• DSH_ERR_HTTP_UNKNOWN (11004):
HTTP error: unknown error
For an overview of all error messages, see “libdsh errors” on page 234.
Example
Get all attributes of component c1 of document d1 in archive A1:
author="Gabriel";copyright="IXOS";created="2000";
Related Functions
82 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
3.15. dshDsGetAttribute: Get attributes
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 83
AR100500-PSA-EN-3
Chapter 3 libdsh function reference
1023400002;12;A1;aaabbcdsewrdfa3yyx;data;1;A1_dsk1;-;127.0.0.1
1023404262;12;A1;aaabbcdsewrdfa3yyx;note;1;A1_dsk1;-;127.0.0.1
Notes
• If you no longer need the info string, call dshFree() to free the
respective memory buffer (but be careful not to use the info pointer
here).
• The document history is available only if the auditing feature is activated
for the appropriate logical archive (compliance mode – see Section 38.1
“Auditing” in OpenText Archive Server - Administration Guide (AR-ACN)
for details). If you call the function for documents on an archive for
which auditing is not active, the resulting info string is empty.
Function Header
char *dshDsGetDocumentHistory(
void *dsh,
const char *aid,
const char *docid
);
[3] In contrast to encrypted timestamps, this is just a common date/time value. Also see corresponding note
in “Timestamp functionality” on page 23.
84 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
3.16. dshDsGetDocumentHistory: Get document history
Parameters
• dsh (input)
Class handle, obtained via a preceding dshOpen() call.
• aid (input)
Archive name
• docid (input)
Document ID
Return values
Document history on success, see Purpose above.
NULL: Error; use the dshGetLastErrno function to obtain further error
information.
• DSH_ERR_HTTP_EMPTY_RESULT (11002):
Wrong (empty) result from archive server
• DSH_ERR_UNKNOWN_ARCHIVE (11206):
Unknown archive
• DSH_ERR_HTTP_400 (11005):
HTTP error (bad request [400]): Unknown function or parameter
• DSH_ERR_HTTP_401 (11006):
HTTP error (unauthorized [401]): Breach of security
• DSH_ERR_HTTP_404 (11008):
HTTP error (not found [404]): Document/component/archive not found
• DSH_ERR_HTTP_500 (11012):
HTTP error (Internal Server Error [500]): Internal error in archive server
• DSH_ERR_HTTP_CONNECTION_BROKEN (11003):
HTTP error: connection was broken
• DSH_ERR_HTTP_UNKNOWN (11004):
HTTP error: unknown error
For an overview of all error messages, see “libdsh errors” on page 234.
Example
See Purpose above
Related Functions
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 85
AR100500-PSA-EN-3
Chapter 3 libdsh function reference
Notes
• Do not evaluate the information string by means of your own functions.
The contents or structure of this string may change in later software
versions, and using the dshCompInfo function will help preserve their
compatibility.
• The function may also be used to check for the existence of a document:
If the function call causes a DSH_ERR_HTTP_404 error, the document does
not exist (or you specified an archive name that does not exist). – To
check for the existence of a document component, use the dshIsComp
function.
• Call dshFree() to free the memory buffer that has been allocated for the
returned info string.
Function Header
char *dshDsInfo(
void *dsh,
const char *aid,
const char *docid,
const char *compid
);
Parameters
• dsh (input)
Class handle, obtained via a preceding dshOpen() call.
• aid (input)
Archive name
• docid (input)
Document ID
• compid (input)
Component name. Specify "" if you want to retrieve the information on all
components of the document.
Return values
Info string on success, to be evaluated via dshCompInfo.
NULL: Error; use the dshGetLastErrno function to obtain further error
information
86 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
3.17. dshDsInfo: Get info string for document/Component
For an overview of all error messages, see “libdsh errors” on page 234.
SecKey access mode
Requires read access permission for the document on the server.
Example
See “dshCompInfoStatus [DEPRECATED]:
Get information on (unknown) components” on page 45 and “dsh_get
example: Get all archived files of a document/retrieve component information”
on page 202
See also “dsh_get example: Get all archived files of a document/retrieve
component information” on page 202
Related Functions
• “dshCompInfoStatus [DEPRECATED]:
Get information on (unknown) components” on page 45
• “dshGetCompStatus: Get information on component” on page 136
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 87
AR100500-PSA-EN-3
Chapter 3 libdsh function reference
88 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
3.18. dshDsMigrate, dshDsMigrate2: Migrate document to another logical archive or
pool
Function Header
int dshDsMigrate(
void *dsh,
const char *aid,
const char *docid,
const char *vol_name,
const char *pool_name,
const char *aid_dest,
const char *retention,
const char *comp_view,
int flag,
char **info
);
int dshDsMigrate2(
void *dsh,
const char *aid,
const char *docid,
const char *vol_name,
const char *pool_name,
const char *storage_tier,
const char *aid_dest,
const char *retention,
const char *comp_view,
int flag,
char **info
);
Parameters
• dsh (input)
Class handle, obtained via a preceding dshOpen() call.
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 89
AR100500-PSA-EN-3
Chapter 3 libdsh function reference
• aid (input)
Name of the source archive, from which the document should be moved to
the target.
• docid (input)
Document ID of the document to be moved
• vol_name (input, optional)
Name of a source volume. If specified, only the components stored on this
volume are moved to the target.
• pool_name (input, optional)
Name of the target document pool. If not specified, the default pool of the
destination archive is used.[4]
• storage_tier (input, optional; dshDsMigrate2 only)
Name of the target storage tier; the server then looks for the pool assigned to
this tier in the target archive and stores the document/component there.
Do not specify both storage_tier and app_type in the same function call; if
both are specified and lead to different pools to be used, the call will fail.
• aid_dest (input)
Name of the destination archive. If not specified, the document remains in
the source archive, but is moved to the specified pool within this archive.
• retention (input, optional)
Retention period of the document – see “Retention period” on page 24 for
details. If not specified, the default retention period of the destination archive
is assigned.
Note that the retention period specified here is added to the date when the
component originally has been created, not to the date of the migration.
• comp_view (input, optional)
This parameter is used for service purposes only. Do not assign a value here.
• flag (input, optional)
Specify 1 if you want to force the migration even if the destination archive
and pool are identical to the source. Otherwise, only those components are
migrated where the destination differs from the source.
• info (output)
Info string for the component that can be evaluated with the dshCompInfo
function
Return values
1: Function completed successfully.
0: Error; use the dshGetLastErrno function to obtain further error information.
90 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
3.18. dshDsMigrate, dshDsMigrate2: Migrate document to another logical archive or
pool
• DSH_ERR_HTTP_400 (11005):
HTTP error (bad request [400]): Unknown function or parameter
• DSH_ERR_HTTP_401 (11006):
HTTP error (unauthorized [401]): Breach of security
• DSH_ERR_HTTP_404 (11008):
HTTP error (not found [404]): Document/component/archive not found
• DSH_ERR_HTTP_500 (11012):
HTTP error (Internal Server Error [500]): Internal error in archive server
• DSH_ERR_HTTP_CONNECTION_BROKEN (11003):
HTTP error: connection was broken
• DSH_ERR_HTTP_UNKNOWN (11004):
HTTP error: unknown error
For an overview of all error messages, see “libdsh errors” on page 234.
Example
Migrate the document d1 from the archive A1 to the archive A2. The retention
period of the migrated document should be 720 days (2 years)
char *info;
int ret = dshDsMigrate(dsh,"A1","d1",NULL,NULL,"A2","720",
"all",0,&info);
...
dshFree(info);
Related Functions
• “dshCompInfo: Get information on (unknown) components” on page 41
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 91
AR100500-PSA-EN-3
Chapter 3 libdsh function reference
Function Header
int dshDsLock(
void *dsh,
const char *aid,
const char *docid,
const char *locker
);
Parameters
• dsh (input)
Class handle, obtained via a preceding dshOpen() call.
• aid (input)
Archive name
• docid (input)
Document ID
• locker (input)
ID for later unlocking (see Purpose above).
Return values
1: Function completed successfully.
2: Document is already locked (corresponds to the DSH_ERR_HTTP_409_LOCK
error).
0: Error; use the dshGetLastErrno function to obtain further error information.
92 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
3.19. dshDsLock: Lock document
• DSH_ERR_HTTP_401 (11006):
HTTP error (unauthorized [401]): Breach of security
• DSH_ERR_HTTP_404 (11008):
HTTP error (not found [404]): Document/component/archive not found
• DSH_ERR_HTTP_409_LOCK (11018):
HTTP error (conflict [409]): There was already a lock on the document
• DSH_ERR_HTTP_500 (11012):
HTTP error (Internal Server Error [500]): Internal error in archive server
• DSH_ERR_HTTP_CONNECTION_BROKEN (11003):
HTTP error: connection was broken
• DSH_ERR_HTTP_UNKNOWN (11004):
HTTP error: unknown error
For an overview of all error messages, see “libdsh errors” on page 234.
Example
Lock document d1 in archive A1 by specifying your client ID as locker string:
Related Functions
• “dshDsUnlock: Unlock document” on page 110
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 93
AR100500-PSA-EN-3
Chapter 3 libdsh function reference
Notes
• Instead of explicitly addressing a certain server, the function requires
that you specify a logical archive (aid parameter). The respective server
is then addressed automatically. If that server hosts several logical
archives protected by SecKeys, you must transfer the certificate once to
any of the archives involved.
• Apart from transferring the certificate to the server, the certificate must
also be declared locally (via dshSetCertificate or
dshSetCertificateFile) before the first document protected via
SecKeys can be requested.
In addition you must specify several further settings (see Related
functions below) that are also required for building SecKey requests.
See also “Access protection via SecKeys (signed URLs)” on page 22 and
“SecKey handling in libdsh” on page 31 for further details.
Function Header
int dshDsPutCert(
void *dsh,
const char *aid,
const unsigned char *cert_buf,
int cert_len
);
int dshDsPutCertFile(
void *dsh,
const char *aid,
const char *path
);
Parameters
• dsh (input)
94 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
3.20. dshDsPutCert, dshDsPutCertFile: Put certificate to Archive Server
Return values
1: Function completed successfully.
0: Error; use the dshGetLastErrno function to obtain further error information.
For an overview of all error messages, see “libdsh errors” on page 234.
Example
Transfer certificate from file cert.pem to Archive Server hosting the A1 archive.
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 95
AR100500-PSA-EN-3
Chapter 3 libdsh function reference
Related Functions
• “dshSetCertificate, dshSetCertificateFile: Set certificate ”
on page 179
• “dshSetAuthId: Set authenticity” on page 178
• “dshSetPrivateKey, dshSetPrivateKeyFile: Set private key”
on page 187
• “dshSetExpTimeSecKey: Set expiration time for SecKey” on page 182
96 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
3.21. dshDsPutCert2, dshDsPutCertFile2: Put certificate to Archive Server
Notes
Function Header
int dshDsPutCert2(
void *dsh,
const char *aid,
const unsigned char *cert_buf,
int cert_len
const char *privileges;
);
int dshDsPutCertFile2(
void *dsh,
const char *aid,
const char *path
const char *privileges
);
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 97
AR100500-PSA-EN-3
Chapter 3 libdsh function reference
Parameters
• dsh (input)
Class handle, obtained via a preceding dshOpen() call.
• aid (input)
Archive name; the certificate is assigned to the archive specified with this
parameter (still must be enabled with administration client); empty string or
NULL pointer for a global certificate.
• cert_buf (input)
Memory buffer containing the contents of the certificate. The certificate data
must be encoded according to the Distinguished Encoding Rules (DER, see [3
on page 225] in “Further information sources” on page 225).
• cert_len (input)
Size of cert_buf
• path (input)
Path of the certificate file. The file must correspond to the PEM standard
(RFC1424, see [2 on page 225] in “Further information sources” on page 225
for details).“Document/component formats (renditions, file types)”
on page 19
• privileges (input)
Either a NULL pointer to assign the default access modes to the certificate.
or
A string with a combination of following access modes:
• r : to read documents
• c : to create documents
• u : to update documents
• d : to delete documents
• p : to pass by
Return values
1: Function completed successfully.
0: Error; use the dshGetLastErrno function to obtain further error information.
98 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
3.21. dshDsPutCert2, dshDsPutCertFile2: Put certificate to Archive Server
Out of memory
• DSH_ERR_HTTP_400 (11005):
HTTP error (bad request [400]): Unknown function or parameter
• DSH_ERR_HTTP_406 (11009):
HTTP error (not acceptable [406]): Certificate cannot be recognized
• DSH_ERR_HTTP_500 (11012):
HTTP error (Internal Server Error [500]): Internal error in archive server
• DSH_ERR_HTTP_CONNECTION_BROKEN (11003):
HTTP error: connection was broken
• DSH_ERR_HTTP_UNKNOWN (11004):
HTTP error: unknown error
For an overview of all error messages, see “libdsh errors” on page 234.
Example
Transfer global certificate from local file cert.pem to Archive Server and set
privileges to allow to read, create, update and to delete documents.
Related Functions
• “dshSetCertificate, dshSetCertificateFile: Set certificate ”
on page 179
• “dshSetAuthId: Set authenticity” on page 178
• “dshSetPrivateKey, dshSetPrivateKeyFile: Set private key”
on page 187
• “dshSetExpTimeSecKey: Set expiration time for SecKey” on page 182
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 99
AR100500-PSA-EN-3
Chapter 3 libdsh function reference
Note: Call dshFree() to free the memory buffer that has been allocated for
the returned Document ID.
Function Header
char *dshDsReserveDocId(
void *dsh,
const char *aid
const char *docid
);
Parameters
• dsh (input)
Class handle, obtained via a preceding dshOpen() call.
• aid (input)
Archive name
• docid (input)
Document ID. If you specify "", the Document ID is generated by the server
and returned via the function return value (not via the docid parameter!).
Otherwise a new document is generated with the specified ID; in this case,
you are responsible for providing a unique Document ID, which is not yet in
use. If you specify an existing Document ID, the function will return the
existing Document ID.
Return values
Document ID on success.
NULL: Error; use the dshGetLastErrno function to obtain further error
information
Errors that may occur
• DSH_ERR_HTTP_EMPTY_RESULT (11002):
Unknown archive
• DSH_ERR_HTTP_CONNECTION_BROKEN (11003):
Out of memory
100 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
3.22. dshDsReserveDocId: Get new document ID
• DSH_ERR_HTTP_UNKNOWN (11004):
HTTP error (bad request [400]): Unknown function or parameter
• DSH_ERR_HTTP_400 (11005):
HTTP error (not acceptable [406]): Certificate cannot be recognized
• DSH_ERR_HTTP_401 (11006):
HTTP error: connection was broken
• DSH_ERR_HTTP_500 (11012):
HTTP error (Internal Server Error [500]): Internal error in archive server
• DSH_ERR_UNKNOWN_ARCHIVE (11206):
HTTP error: unknown error
• DSH_ERR_ACCESS_FILE (11207):
HTTP error: unknown error
For an overview of all error messages, see “libdsh errors” on page 234.
Example
Get a new Document ID from Archive Server of archive A1:
Related Functions
• “dshDsCreate*, dshDsCreateFile*: Create document/Component”
on page 64
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 101
AR100500-PSA-EN-3
Chapter 3 libdsh function reference
Notes
• Call dshFree() to free the memory buffer that has been allocated for the
returned search result string.
• The only difference between two functions is the type assignment of the
parameters from_offset and to_offset.
Function Header
char *dshDsSearch(
void *dsh,
const char *aid,
const char *docid,
const char *compid,
const char *pattern,
long from_offset,
long to_offset,
int num_results,
int case_sensitive
);
char *dshDsSearch2(
void *dsh,
const char *aid,
const char *docid,
const char *compid,
const char *pattern,
int64_t from_offset,
int64_t to_offset,
int num_results,
int case_sensitive
);
Parameters
• dsh (input)
Class handle, obtained via a preceding dshOpen() call.
102 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
3.23. dshDsSearch, dshDsSearch2: Search in component
• aid (input)
Archive name
• docid (input)
Document ID
• compid (input)
Component name
• pattern (input)
Search pattern
• from_offset (input)
Offset where to start search
• to_offset (input)
Offset where to stop search; specify -1 for searching until the end)
• num_results (input)
Maximum number of search results
• case_sensitive (input)
Specify 0 for case-insensitive search (a=A)
Specify 1 for case-sensitive search (a!=A)
Return values
Search result, see Purpose above.
“0;”: No hits have been found.
NULL: Error; use the dshGetLastErrno function to obtain further error
information.
Errors that may occur
• DSH_ERR_ACCESS_FILE (11207):
Error in accessing file
• DSH_ERR_UNKNOWN_ARCHIVE (11206):
Unknown archive
• DSH_ERR_HTTP_400 (11005):
HTTP error (bad request [400]): Unknown function or parameter
• DSH_ERR_HTTP_401 (11006):
HTTP error (unauthorized [401]): Breach of security
• DSH_ERR_HTTP_404 (11008):
HTTP error (not found [404]): Document/component/archive not found
• DSH_ERR_HTTP_409 (11010):
HTTP error (conflict [409]): Document/component/administrat. data is
inaccessible
• DSH_ERR_HTTP_500 (11012):
HTTP error (Internal Server Error [500]): Internal error in archive server
• DSH_ERR_HTTP_CONNECTION_BROKEN (11003):
HTTP error: connection was broken
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 103
AR100500-PSA-EN-3
Chapter 3 libdsh function reference
• DSH_ERR_HTTP_UNKNOWN (11004):
HTTP error: unknown error
• DSH_ERR_HTTP_560_ONTAPE
HTTP error (document not accessible [560]): The document cannot be
accessed because it is on tape.
For an overview of all error messages, see “libdsh errors” on page 234.
Example
Search first two occurrences of pattern “Specification” in component c1 of
document d1 in archive A1:
2;1010;2000;
meaning that 2 hits were found, one starting at offset 1010 and the other starting
at offset 2000 (but note that the document may contain further hits, which were
not found because the number of hits has been limited to 2 in the function call).
See also “dsh_search example: Searching and getting the found piece of data”
on page 214
104 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
3.24. dshDsSetAttribute: Set attribute
Note: If you operate in an OpenText TCP system, but want to keep the
attribute naming as used in archive-centric systems, a name mapping must
be defined via the Server Configuration.
Function Header
int dshDsSetAttribute(
void *dsh,
const char *aid,
const char *docid,
const char *compid,
const char *attribute,
const char *value
);
Parameters
• dsh (input)
Class handle, obtained via a preceding dshOpen() call.
• aid (input)
Archive name
• docid (input)
Document ID
• compid (input)
Component name. Specify "" if you want to set the attribute for the docid
document instead of a certain component.
• attribute (input)
Attribute name
• value (input)
Attribute value
Return values
1: Function completed successfully.
0: Error; use the dshGetLastErrno function to obtain further error information
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 105
AR100500-PSA-EN-3
Chapter 3 libdsh function reference
For an overview of all error messages, see “libdsh errors” on page 234.
Example
Set attribute author for component c1 of document d1, located in archive A1,
and assign Gabriel as value:
Related Functions
• “dshDsGetAttribute: Get attributes” on page 81
106 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
3.25. dshDsSetDocumentFlag: Start delayed processing
Parameters
• dsh (input)
Class handle, obtained via a preceding dshOpen() call.
• aid (input)
Archive name
• docid (input)
Document ID
• compid (input)
Component name. Specify "" or NULL if you want to refer to the entire
document instead of a specific component.
• retention_period (input)
Retention period (in days) to be assigned to the component or document –
see “Retention period” on page 24 for details.
• store_param (input)
Sub-function to be processed:
• immediate: Apply to a document that has been stored using
dshDsCreate* with store_param="delayed" to send this document
from the disk buffer to the archive storage now.
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 107
AR100500-PSA-EN-3
Chapter 3 libdsh function reference
Return values
1: Function completed successfully.
0: Error; use the dshGetLastErrno function to obtain further error information
For an overview of all error messages, see “libdsh errors” on page 234.
Example
Set retention period for event-based document d1 in archive A1 to 720 days (2
years):
int ret =
dshDsSetDocumentFlag(dsh,"A1","d1","","720","setEvent");;
Related Functions
• “dshDsMigrate, dshDsMigrate2: Migrate document to another logical
archive or pool” on page 89
108 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
3.25. dshDsSetDocumentFlag: Start delayed processing
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 109
AR100500-PSA-EN-3
Chapter 3 libdsh function reference
Parameters
• dsh (input)
Class handle, obtained via a preceding dshOpen() call.
• aid (input)
Archive name
• docid (input)
Document ID
• locker (input)
ID for unlocking (must correspond to the locker parameter specified when
the document was locked).
• force (input)
Force unlocking (specify "yes" or "no")
Return values
1: Function completed successfully.
2: The specified locker parameter does not match the string used when the
document was locked. (corresponds to DSH_ERR_HTTP_409_UNLOCK).
3: The document is not locked at all (corresponds to
DSH_ERR_HTTP_412_UNLOCK).
0: Error; use the dshGetLastErrno function to obtain further error information.
110 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
3.26. dshDsUnlock: Unlock document
Unknown archive
• DSH_ERR_HTTP_400 (11005):
HTTP error (bad request [400]): Unknown function or parameter
• DSH_ERR_HTTP_401 (11006):
HTTP error (unauthorized [401]): Breach of security
• DSH_ERR_HTTP_404 (11008):
HTTP error (not found [404]): Document/component/archive not found
• DSH_ERR_HTTP_409_UNLOCK (11019):
HTTP error (conflict [409]): The document was not locked by locker.
Therefore the lock could not be removed
• DSH_ERR_HTTP_412_UNLOCK (11021):
HTTP error (precondition failed [412]): The document was not locked
• DSH_ERR_HTTP_500 (11012):
HTTP error (Internal Server Error [500]): Internal error in archive server
• DSH_ERR_HTTP_CONNECTION_BROKEN (11003):
HTTP error: connection was broken
• DSH_ERR_HTTP_UNKNOWN (11004):
HTTP error: unknown error
For an overview of all error messages, see “libdsh errors” on page 234.
Example
Force unlocking of document d1 in archive A1
Related Functions
• “dshDsLock: Lock document” on page 92
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 111
AR100500-PSA-EN-3
Chapter 3 libdsh function reference
Important
• Use these functions with care:
Once you apply one of them to a document, the former component
version is permanently deleted! There is no undo option for these
functions (or for any libdsh function).
• Do not modify composed documents (form overlays, notes,
annotations)!
libdsh does not support composed documents, for example, form
overlays, notes or annotations. Therefore you should not modify or
replace components in a document using form overlays, notes or
annotations, as this may impact the structural relationship between
the individual components and may destroy the document (see also
“Document model” on page 14).
If the document has been stored on an optical medium, its components cannot
be changed, of course. Instead a new component (or even a completely new
document) is generated and any reference to the old component within the
database is removed; so the former component version cannot be found any
longer. There is only a chance to restore a component version after
dshDsUpdate(File), if a database backup has been performed short time before
deletion.
Note that these functions always replace a component as a whole; you cannot
modify a single component property (for example, type or compid) by
specifying the respective parameter and leaving the other parameters empty. In
particular if you specify an empty data parameter, this will generate an empty
document (and if you use an existing docid/compid pair, it will overwrite the
existing component!).
As a rule, dshDsUpdate* is required only for updating notes or annotations that
can be modified by definition, or for test purposes. If you intend to use the
function in a different context, do not forget to inform your users accordingly:
Modifications in a document are quite an unexpected feature in the context of an
archive.
Function Header
int dshDsUpdate(
void *dsh,
112 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
3.27. dshDsUpdate*, dshDsUpdateFile*: Update component
int dshDsUpdate2(
void *dsh,
const char *aid,
const char *docid,
const char *compid,
const char *type,
char *data,
long size,
const char *app_type
const char *timestamp
);
int dshDsUpdate3(
void *dsh,
const char *aid,
const char *docid,
const char *compid,
const char *type,
char *data,
long size,
const char *app_type
const char *timestamp
const char *storage_tier
);
int dshDsUpdateFile(
void *dsh,
const char *aid,
const char *docid,
const char *compid,
const char *type,
const char *path,
const char *app_type
);
int dshDsUpdateFile2(
void *dsh,
const char *aid,
const char *docid,
const char *compid,
const char *type,
const char *path,
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 113
AR100500-PSA-EN-3
Chapter 3 libdsh function reference
Parameters
• dsh (input)
Class handle, obtained via a preceding dshOpen() call.
• aid (input)
Archive name
• docid (input)
Document ID
• compid (input)
Component name
• type (input)
File type of the component (see “Document/component formats (renditions,
file types)” on page 19).
• data (input)
Data of component compid
• size (input)
Size of the data buffer (= size of the compid component after the
modification)
• path (input)
Local filename of component compid
• app_type (input)
Application type for pool selection (see “Document pools, storage tiers”
on page 12).
Specify the empty string ("") for the default pool.
• timestamp (input; dshDsUpdate2/3, dshDsUpdateFile2/3 only)
Optional timestamp to be stored with the component (format: DER->BASE64)
– see “Timestamp functionality” on page 23.
If you specify "" or the NULL pointer, the parameter is ignored.
• storage_tier (input; dshDsUpdate3, dshDsUpdateFile3 only)
114 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
3.27. dshDsUpdate*, dshDsUpdateFile*: Update component
Optional storage tier to be assigned to the component; the server then looks
for the pool assigned to the storage tier and stores that component in that
pool.
If you specify "" or the NULL pointer, the default pool is used.
Do not specify both storage_tier and app_type in the same function call; if
both are specified and lead to different pools to be used, the call will fail.
Return values
1: Function completed successfully.
0: Error; use the dshGetLastErrno function to obtain further error information.
For an overview of all error messages, see “libdsh errors” on page 234.
SecKey access mode
Requires update access permission for the document on the server.
Example
Replace component c1 of document d1 of archive A1 with content of file x.txt,
and set the type of the component to application/xyz:
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 115
AR100500-PSA-EN-3
Chapter 3 libdsh function reference
Related Functions
• “dshDsCreate*, dshDsCreateFile*: Create document/Component”
on page 64
• “dshDsLock: Lock document” on page 92
116 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
3.28. dshDsValidUser2: Check user account
Notes
• dshDsValidUser is deprecated since libdsh_3; use dshDsValidUser2
instead.
• Call dshFree() to free the memory buffer that has been allocated for the
returned string.
• For the user_sys values DS, OS, and R3, user and passwords are sent via
HTTPS protocol to Archive Server.
Function Header
char *dshDsValidUser2(
void *dsh,
const char *user,
const char *passwd,
const char *user_sys
);
Parameters
• dsh (input)
Class handle, obtained via a preceding dshOpen() call.
• user (input)
Archive user
• passwd (input)
Password of archive user
• user_sys (input)
User management system that the ADMS shall use for checking and an
encryption option:
"DS" = DS user, no encryption
"DS_ENC" = DS user, encrypted transmission
"OS" = operating system user, no encryption
"OS_ENC" = operating system user, encrypted transmission
"R3" = SAP user, no encryption (not yet implemented)
"R3_ENC" = SAP user, encrypted transmission (not yet implemented)
As a rule, you should use one of the *_ENC options; only if that should fail,
you may try an option without encryption.
Return values
Groups of the user specified in user, see Purpose above.
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 117
AR100500-PSA-EN-3
Chapter 3 libdsh function reference
• DSH_ERR_HTTP_EMPTY_RESULT (11002):
Wrong (empty) result from archive server
• DSH_ERR_ACCESS_FILE (11207):
Error in accessing file
• DSH_ERR_UNKNOWN_ARCHIVE (11206):
Unknown archive
• DSH_ERR_HTTP_400 (11005):
HTTP error (bad request [400]): Unknown function or parameter
• DSH_ERR_HTTP_401 (11006):
HTTP error (unauthorized [401]): Breach of security
• DSH_ERR_HTTP_404_VU (11014):
HTTP error (not found [404]): A user account with the specified user/passwd
combination does not exist. The user is not found
• DSH_ERR_HTTP_500 (11012):
HTTP error (Internal Server Error [500]): Internal error in archive server
• DSH_ERR_HTTP_CONNECTION_BROKEN (11003):
HTTP error: connection was broken
• DSH_ERR_HTTP_UNKNOWN (11004):
HTTP error: unknown error
For an overview of all error messages, see “libdsh errors” on page 234.
Example
Check whether user Gabriel with password PSWD is a valid user account in
archive A1:
group="dsadmin,dpadmin"
meaning that user Gabriel belongs to two groups, dsadmin and dpadmin.
Related Functions
See also “Grouped function list” on page 28.
118 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
3.29. dshDsVerifyATS: Verify signature of an ArchiSig timestamp
Notes
• The configuration variable DSH_VERIFY_SIG_TIMEOUT specifies a
timeout for this call. See “Global environment variables” on page 228 for
details.
• For further information on timestamps, see Section 14.4 “Timestamps” in
OpenText Archive Server - Administration Guide (AR-ACN).
• Using the dshCompInfo function, you can determine whether a
component has a timestamp (sig_object parameter).
• Call dshFree() to free the memory buffer that has been allocated for the
returned string.
Function Header
int dshDsVerifyATS(
void *dsh,
const char *aid,
const char *docid,
const char *compid,
const char *vol_name,
const char *file,
const char *data,
long size,
const char *hashalg,
char **result_string
);
Parameters
• dsh (input)
Class handle, obtained via a preceding dshOpen() call.
• aid (input)
Archive name
• docid (input)
Document ID
• compid (input)
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 119
AR100500-PSA-EN-3
Chapter 3 libdsh function reference
Component name
• vol_name (input, optional)
Name of the harddisk volume containing the component to be checked.
Using this parameter, you can explicitly address a component on a specific
volume to be checked, in case that a components exists on several volumes
and you want to check a specific one of them.
• file (input, optional)
Name of a local file to be checked (see Purpose above)
• data (input, optional)
Pointer to a memory buffer to be proofed (see Purpose above)
• size (input, optional)
Number of bytes of the component to be proofed
• hashalg (input)
Choose hashing function of ArchiSig timestamp, examples:
• RMD160
• SHA256
• SHA512
• result_string (output)
Result string of the verification
Return values
1: Verification was successful.
2: Verification of signature was successful, but verification of certificate failed.
3: Other error returned from DS.
0: Other error; use the dshGetLastErrno function to obtain further error
information.
120 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
3.29. dshDsVerifyATS: Verify signature of an ArchiSig timestamp
• DSH_ERR_HTTP_UNKNOWN (11004):
HTTP error: unknown error
• DSH_ERR_OUT_OF_MEMORY (11204):
Out of memory
• DSH_ERR_HTTP_560_ONTAPE
HTTP error (document not accessible [560]): The document cannot be
accessed because it is on tape.
For an overview of all error messages, see “libdsh errors” on page 234.
Example
Verify ArchiSig signature (timestamp) of component c1 of document d1 of
archive A1:
char *result_string;
int ret = dshDsVerifyATS(dsh,"A1","d1","c1",NULL,NULL,
NULL,0,0,&result_string);
...
dshFree(result_string);
result="0";resultDescr=""
docId="aaaad6ggguquucahbaaaaaev4ofv3";compId="9277.otf";compVers=
"1";volume="HD40";compSizeSigned="389";compSizeActual="389"
Sequence[1]:result="0";resultDescr="";hashAlg="SHA1"
Chain[1]:result="0";resultDescr="";signDate="2009-05-11";signTime
="11:09:00"
signer="/C=DE/O=OpenText/CN=Demo
TSS1";result="0";resultDescr="";expireDate="2015-05-28";expireTim
e="13:58:19"
signer="/C=DE/O=OpenText/CN=Demo
CA";result="0";resultDescr="";expireDate="2015-05-29";expireTime=
"13:49:42"
signer="/C=DE/O=OpenText/CN=Demo
Root";result="0";resultDescr="Self-signed certificate enabled in
admin server.";expireDate="2015-05-30";expireTime="13:42:20"
Chain[2]:result="0";resultDescr="";signDate="2009-05-11";signTime
="11:09:37"
signer="/C=DE/O=OpenText/CN=Demo
TSS1";result="0";resultDescr="";expireDate="2015-05-28";expireTim
e="13:58:19"
signer="/C=DE/O=OpenText/CN=Demo
CA";result="0";resultDescr="";expireDate="2015-05-29";expireTime=
"13:49:42"
signer="/C=DE/O=OpenText/CN=Demo
Root";result="0";resultDescr="Self-signed certificate enabled in
admin server.";expireDate="2015-05-30";expireTime="13:42:20"
Chain[3]:result="0";resultDescr="";signDate="2009-05-11";signTime
="11:10:01"
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 121
AR100500-PSA-EN-3
Chapter 3 libdsh function reference
signer="/C=DE/O=OpenText/CN=Demo
TSS1";result="0";resultDescr="";expireDate="2015-05-28";expireTim
e="13:58:19"
signer="/C=DE/O=OpenText/CN=Demo
CA";result="0";resultDescr="";expireDate="2015-05-29";expireTime=
"13:49:42"
signer="/C=DE/O=OpenText/CN=Demo
Root";result="0";resultDescr="Self-signed certificate enabled in
admin server.";expireDate="2015-05-30";expireTime="13:42:20"
Sequence[2]:result="0";resultDescr="";hashAlg="SHA256"
Chain[1]:result="0";resultDescr="";signDate="2009-05-11";signTime
="11:11:35"
signer="/C=DE/O=OpenText/CN=Demo
TSS1";result="0";resultDescr="";expireDate="2015-05-28";expireTim
e="13:58:19"
signer="/C=DE/O=OpenText/CN=Demo
CA";result="0";resultDescr="";expireDate="2015-05-29";expireTime=
"13:49:42"
signer="/C=DE/O=OpenText/CN=Demo
Root";result="0";resultDescr="Self-signed certificate enabled in
admin server.";expireDate="2015-05-30";expireTime="13:42:20"
Chain[2]:result="0";resultDescr="";signDate="2009-05-11";signTime
="11:13:56"
signer="/C=DE/O=OpenText/CN=Demo
TSS1";result="0";resultDescr="";expireDate="2015-05-28";expireTim
e="13:58:19"
signer="/C=DE/O=OpenText/CN=Demo
CA";result="0";resultDescr="";expireDate="2015-05-29";expireTime=
"13:49:42"
signer="/C=DE/O=OpenText/CN=Demo
Root";result="0";resultDescr="Self-signed certificate enabled in
admin server.";expireDate="2015-05-30";expireTime="13:42:20"
Sequence[3]:result="0";resultDescr="";hashAlg="SHA512"
Chain[1]:result="0";resultDescr="";signDate="2009-05-11";signTime
="11:14:39"
signer="/C=DE/O=OpenText/CN=Demo
TSS1";result="0";resultDescr="";expireDate="2015-05-28";expireTim
e="13:58:19"
signer="/C=DE/O=OpenText/CN=Demo
CA";result="0";resultDescr="";expireDate="2015-05-29";expireTime=
"13:49:42"
signer="/C=DE/O=OpenText/CN=Demo
Root";result="0";resultDescr="Self-signed certificate enabled in
admin server.";expireDate="2015-05-30";expireTime="13:42:20"
Chain[2]:result="0";resultDescr="";signDate="2009-05-11";signTime
="11:15:13"
signer="/C=DE/O=OpenText/CN=Demo
TSS1";result="0";resultDescr="";expireDate="2015-05-28";expireTim
e="13:58:19"
signer="/C=DE/O=OpenText/CN=Demo
CA";result="0";resultDescr="";expireDate="2015-05-29";expireTime=
"13:49:42"
signer="/C=DE/O=OpenText/CN=Demo
122 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
3.29. dshDsVerifyATS: Verify signature of an ArchiSig timestamp
Related Functions
• “dshCompInfo: Get information on (unknown) components” on page 41
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 123
AR100500-PSA-EN-3
Chapter 3 libdsh function reference
Notes
• The configuration variable DSH_VERIFY_SIG_TIMEOUT specifies a
timeout for this call. See “Global environment variables” on page 228 for
details.
• For further information on timestamps, see Section 14.4 “Timestamps” in
OpenText Archive Server - Administration Guide (AR-ACN).
• Using the dshCompInfo function, you can determine whether a
component has a timestamp (sig_object parameter).
• Call dshFree() to free the memory buffer that has been allocated for the
returned string.
Function Header
int dshDsVerifySig(
void *dsh,
const char *aid,
const char *docid,
const char *compid,
const char *vol_name,
const char *file,
const char *data,
long size,
int flag,
char **result_string
);
Parameters
• dsh (input)
Class handle, obtained via a preceding dshOpen() call.
• aid (input)
Archive name
• docid (input)
Document ID
• compid (input)
124 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
3.30. dshDsVerifySig: Proof timestamp of a component
Component name
• vol_name (input, optional)
Name of the harddisk volume containing the component to be checked.
Using this parameter, you can explicitly address a component on a specific
volume to be checked, in case that a components exists on several volumes
and you want to check a specific one of them.
• file (input, optional)
Name of a local file to be checked (see Purpose above)
• data (input, optional)
Pointer to a memory buffer to be proofed (see Purpose above)
• size (input, optional)
Number of bytes of the component to be proofed
• flags (input, optional)
Controls the output returned in the <result_string> parameter:
• Specify 0 to get default output (see example below).
• Specify 1 to get timestamp in the result string, additionally.
• Specify 2 to get the certificates in the result string, additionally.
• result_string (output)
Result string of the verification
Return values
1: Verification was successful.
2: Verification of signature was successful, but verification of certificate failed.
3: Other error returned from DS.
0: Other error; use the dshGetLastErrno function to obtain further error
information.
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 125
AR100500-PSA-EN-3
Chapter 3 libdsh function reference
For an overview of all error messages, see “libdsh errors” on page 234.
Example
Verify signature (timestamp) of component c1 of document d1 of archive A1:
char *result_string;
int ret = dshDsVerifySig(dsh,"A1","d1","c1",NULL,NULL,
NULL,0,0,&result_string);
...
dshFree(result_string);
result="0";resultDescr=""
docId="testdoc";compId="data";compVers="1";signDate="2003-12-01";
signTime="13:55:49";
signer="/C=DE/O=IXOS/OU=TSS/CN=TS00";result="0";resultDescr=""
signer="/C=DE/O=IXOS/CN=CA";result="0";resultDescr=""
signer="/C=DE/O=IXOS/CN=Root";result="0";resultDescr=""
Related Functions
• “dshCompInfo: Get information on (unknown) components” on page 41
126 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
3.31. dshExit: Exit the libdsh library
Function Header
void dshExit(void);
Parameters
none
Return values
No return values
Example
Your program source code may look as follows:
void *dsh = dshOpen(...); /* first call of library libdsh! */
...
... use library libdsh
... some dsh-function calls
...
dshClose(dsh); /* closing the connection */
dshExit(); /* last call of library libdsh! */
See also the examples in “Archive Server API in practice“ on page 193
Related Functions
• “dshClose: Close connection to repository server” on page 40
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 127
AR100500-PSA-EN-3
Chapter 3 libdsh function reference
Function Header
void dshFree(void *ptr);
Parameters
• ptr (input)
pointer to allocated memory
Return values
No return values
Example
char *search_result = dshDsSearch(...);
...
... doing something with server_info . . .
...
dshFree(search_result);
See also “dsh_attribute example: dealing with document attributes”
on page 209,
“dsh_search example: Searching and getting the found piece of data”
on page 214
128 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
3.33. dshGetAidRefreshInterval: Get aid refresh interval
Function Header
int dshGetAidRefreshInterval(void *dsh);
Parameters
• dsh (input)
Class handle, obtained via a preceding dshOpen() call.
Return values
Refresh interval, specified in seconds.
Example
Related Functions
• “dshSetAidRefreshInterval: Set refresh interval for ADMS info”
on page 174
• “dshGetAidRefreshTime: Get time of next ADMS info refresh ”
on page 130
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 129
AR100500-PSA-EN-3
Chapter 3 libdsh function reference
Function Header
time_t dshGetAidRefreshTime(void *dsh);
Parameters
• dsh (input)
Class handle, obtained via a preceding dshOpen() call.
Return values
Time of next ADMS refresh (see Purpose above)
Example
Related Functions
• “dshSetAidRefreshTime: Set time of next ADMS info refresh”
on page 175
• “dshGetAidRefreshInterval: Get aid refresh interval” on page 129
130 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
3.35. dshGetApplication: Get application name
Note: Call dshFree() to free the memory buffer that has been allocated for
the returned string.
Function Header
char * dshGetApplication(void *dsh);
Parameters
• dsh (input)
class handle, obtained via a preceding dshOpen() call.
Return values
Application name on success.
NULL on error.
Example
Related Functions
• “dshSetApplication: Set application name ” on page 177
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 131
AR100500-PSA-EN-3
Chapter 3 libdsh function reference
Notes
• Call dshFree() to free the memory buffer that has been allocated for the
returned string.
• See “Access protection via SecKeys (signed URLs)” on page 22 and
“SecKey handling in libdsh” on page 31 for details on the use of SecKeys.
Function Header
char * dshGetAuthId(void *dsh);
Parameters
• dsh (input)
Class handle, obtained via a preceding dshOpen() call.
Return values
Client identifier (authenticity) on success.
NULL on error.
Example
Get the client identifier:
Related Functions
• “dshSetAuthId: Set authenticity” on page 178
132 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
3.37. dshGetCertificateFile: Get filename of certificate
Notes
• Call dshFree() to free the memory buffer that has been allocated for the
returned string.
• See “Access protection via SecKeys (signed URLs)” on page 22 and
“SecKey handling in libdsh” on page 31 for details on the use of SecKeys.
Function Header
char *dshGetCertificateFile(void);
Parameters
none
Return values
Certificate filename on success.
NULL: Error; use the dshGetLastErrno function to obtain further error
information.
Example
Get the filename of the certificate:
Related Functions
• “dshSetCertificate, dshSetCertificateFile: Set certificate ”
on page 179
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 133
AR100500-PSA-EN-3
Chapter 3 libdsh function reference
Note: Call dshFree() to free the memory buffer that has been allocated for
the returned string.
Function Header
char *dshGetCompSize(
void *dsh,
const char *aid,
const char *docid,
const char *compid
);
Parameters
• dsh (input)
class handle, obtained via a preceding dshOpen() call.
• aid (input)
archive name
• docid (input)
Document ID
• compid (input)
component name
Return values
String containing the size of component on success
-1: Size is unknown (for example, decomposed emails)
NULL: Error; use the dshGetLastErrno function to obtain further error
information
134 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
3.38. dshGetCompSize: Get size of component
For an overview of all error messages, see “libdsh errors” on page 234.
Example
Get the size of component c1 of document d1 in archive A1:
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 135
AR100500-PSA-EN-3
Chapter 3 libdsh function reference
Note: If you do not know the components of a document (or their names),
use dshDsInfo and dshCompInfoStatus instead of dshGetCompStatus.
Function Header
int dshGetCompStatus(
void *dsh,
const char *aid,
const char *docid,
const char *compid,
char *status,
char *type,
char *ar_date,
char *ar_time,
char *size,
int utc_flag
);
Parameters
• dsh (input)
Class handle, obtained via a preceding dshOpen() call.
• aid (input)
Archive name
• docid (input)
Document ID
• compid (input)
Component name
• status (output)
Document/component status, which may be one of the following values:
ONLINE, OFFLINE, UNKNOWN, ERROR.
Must be allocated by the calling application with a size >= 21 bytes.
• type (output)
File type of the component (see “Document/component formats (renditions,
file types)” on page 19).
136 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
3.39. dshGetCompStatus: Get information on component
Return values
1: Function completed successfully.
0: Error; use the dshGetLastErrno function to obtain further error information.
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 137
AR100500-PSA-EN-3
Chapter 3 libdsh function reference
For an overview of all error messages, see “libdsh errors” on page 234.
Example
Get the status information of component c1 in document d1, located in archive
A1:
Related Functions
• “dshCompInfo: Get information on (unknown) components” on page 41
• “dshCompInfo: Get information on (unknown) components” on page 41
• “dshDsMigrate, dshDsMigrate2: Migrate document to another logical
archive or pool” on page 89
138 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
3.40. dshGetConfig: Get value of global configuration variable
{<key>=<value>\n}
Notes
Function Header
char * dshGetConfig(
void *dsh,
const char *key
);
Parameters
• dsh (input)
Class handle, obtained via a preceding dshOpen() call.
• key (input)
Name of the variable to be retrieved
Return values
Value of requested variable or list of all variables
Example
Get value (on or off) of the global HTTP log-setting LOG_DSH:
Related Functions
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 139
AR100500-PSA-EN-3
Chapter 3 libdsh function reference
Notes
• In case of unset or unknown values, the NULL pointer is returned in the
appropriate parameter.
• Call dshFree() to free the memory buffer that has been allocated for the
returned string.
Function Header
int dshGetDocInfo(
void *dsh,
const char *aid,
const char *docid,
int utc_flag,
char **status,
char **c_date,
char **c_time,
char **m_date,
char **m_time,
char **retention,
char **r_date,
char **r_time,
int *is_locked,
int *num_comps,
char **info
);
int dshGetDocInfo2(
void *dsh,
const char *aid,
const char *docid,
int utc_flag,
char **status,
char **c_date,
char **c_time,
char **m_date,
char **m_time,
char **retention,
char **r_date,
char **r_time,
int *on_csrv,
140 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
3.41. dshGetDocInfo, dshGetDocInfo2: Get status of a document
int *is_locked,
int *is_delayed,
int *num_comps,
char **info
);
Parameters
• dsh (input)
Class handle, obtained via a preceding dshOpen() call
• aid (input)
Archive name
• docid (input)
Document ID
• utc_flag (input)
Specify 0 to get date and time in localtime.
Specify 1 to get date and time in UTC (Greenwich time).
• status (output)
Online status of the document (online, offline)
• c_date (output)
Creation date of the document (date of first archiving), format YYYYMMDD
• c_time (output)
Creation time of the document (time of first archiving), format HHMMSS
• m_date (output)
Modification date of the document (date of most recent archiving), format
YYYYMMDD
• m_time (output)
Modification time of the document (time of most recent archiving), format
HHMMSS
• retention (output)
Retention mode (see “Retention period” on page 24)
In case of a concrete retention period, the value date is returned and the end
date is returned in r_date and r_time.
• r_date (output)
Retention date, if the retention mode is date (format: YYYYMMDD);
otherwise NULL
• r_time (output)
Retention time, if the retention mode is date (format: HHMMSS);
otherwise NULL
• on_csrv (output, dshGetDocInfo2 only)
Name of the Archive Cache Server where the document is stored if it is not
yet on Archive Server
• is_locked (output)
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 141
AR100500-PSA-EN-3
Chapter 3 libdsh function reference
Lock status
• is_delayed (output, dshGetDocInfo2 only)
Information on whether the status of the document in delayed archiving
mode:
1: The document does not use that mode or has already been finally stored in
the archive.
0: The document is waiting for the final archiving.
• num_comps (output)
Number of components
• info (output)
Component information (see dshDsInfo(), dshCompInfo())
Return values
1: Function completed successfully.
2: Document is unknown.
0: Error; use the dshGetLastErrno function to obtain further error information.
For an overview of all error messages, see “libdsh errors” on page 234.
142 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
3.41. dshGetDocInfo, dshGetDocInfo2: Get status of a document
Example
Get the status information for document d1 in archive A1
char *status, *c_date, *c_time, *m_date, *m_time,
*retention, *r_date, *r_time, *on_csrv, *info;
int is_locked, is_delayed, num_comps;
int ret = dshGetDocInfo2(dsh,"A1","d1",0,&status,&c_date,
&c_time,&m_date,&m_time,
&retention,&r_date,&r_time,
&on_csrv,&is_locked,&is_delayed,
&num_comps,&info);
Related Functions
• “dshDsInfo: Get info string for document/Component” on page 86
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 143
AR100500-PSA-EN-3
Chapter 3 libdsh function reference
Function Header
int dshGetDocStatus(
void *dsh,
const char *aid,
const char *docid,
char *status,
char *type,
char *ar_date,
char *ar_time,
int utc_flag,
int *num_comps
);
Parameters
• dsh (input)
Class handle, obtained via a preceding dshOpen() call.
• aid (input)
Archive name
• docid (input)
Document ID
• status (output)
Document status, which may be one of the following values:
ONLINE, OFFLINE, UNKNOWN, ERROR.
Must be allocated by the calling application with a size >= 21 bytes.
• type (output)
File type of the document (stored in the type document attribute; see also
“Document/component formats (renditions, file types)” on page 19).
Must be allocated by the calling application with a size >= 41 bytes.
• ar_date (output)
Date of (most recent) archiving; format: YYYYMMDD.
144 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
3.42. dshGetDocStatus: Get information on document
Return values
1: Function completed successfully.
0: Error; use the dshGetLastErrno function to obtain further error information.
• DSH_ERR_ACCESS_FILE (11207):
Error in accessing file
• DSH_ERR_UNKNOWN_ARCHIVE (11206):
Unknown archive
• DSH_ERR_FUNCTION_ARGUMENT (11203):
Wrong function argument (for example, NULL pointer)
• DSH_ERR_HTTP_PARSE_HEADER (11001):
Error in parsing HTTP header
• DSH_ERR_HTTP_400 (11005):
HTTP error (bad request [400]): Unknown function or parameter
• DSH_ERR_HTTP_401 (11006):
HTTP error (unauthorized [401]): Breach of security
• DSH_ERR_HTTP_404 (11008):
HTTP error (not found [404]): Document/component/archive not found
• DSH_ERR_HTTP_409_INFO (11020):
HTTP error (conflict [409]): Administrative data is inaccessible
• DSH_ERR_HTTP_500 (11012):
HTTP error (Internal Server Error [500]): Internal error in archive server
• DSH_ERR_HTTP_CONNECTION_BROKEN (11003):
HTTP error: connection was broken
• DSH_ERR_HTTP_UNKNOWN (11004):
HTTP error: unknown error
For an overview of all error messages, see “libdsh errors” on page 234.
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 145
AR100500-PSA-EN-3
Chapter 3 libdsh function reference
Example
Get information on document d1 in archive A1:
int num_comps = 0;
char status[21], type[41], ar_date[9], ar_time[7];
int ret = dshGetDocStatus(dsh,"A1","d1",status,type,
ar_date,ar_time,0,&num_comps);
Related Functions
• “dshGetCompStatus: Get information on component” on page 136
146 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
3.43. dshGetExpTimeSecKey: Get expiration time of SecKey
Notes
• Use the dshSetExpTimeSecKey function to change the expiration time
span.
• See “Access protection via SecKeys (signed URLs)” on page 22and
“SecKey handling in libdsh” on page 31 for details on the use of SecKeys.
Function Header
int dshGetExpTimeSecKey(void *dsh);
Parameters
• dsh (input)
Class handle, obtained via a preceding dshOpen() call.
Return values
Expiration time of SecKeys in seconds
Example
Related Functions
• “dshSetExpTimeSecKey: Set expiration time for SecKey” on page 182
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 147
AR100500-PSA-EN-3
Chapter 3 libdsh function reference
Notes
• The error code buffer is not reset, if you call dshGetLastErrno or
dshGetLastError. If you want to reset it, use the dshClearLastError
function.
• Some functions, particularly those used in getting and setting properties
within libdsh, dshExit, dshClose, dshFree) do not provide any return
value or explicit error condition. The dshGetProxy function does not
return NULL in case of an error; instead, it returns the empty string "".
• See also “Function parameters and return values” on page 36.
Function Header
int dshGetLastErrno(void *dsh);
Parameters
• dsh (input)
Class handle, obtained via a preceding dshOpen() call.
Return values
Error number of the last function call that has failed.
0: No error information available (see “Error handling” on page 35).
Example:
Get the size of component c1 of document d1 in archive A1, check whether an
error occurred and react on it if necessary:
148 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
3.44. dshGetLastErrno: Get error number
See also “Sample programs in detail” on page 198 (whch however use the
dshGetLastError function instead of dshGetLastErrno).
Related Functions
• “dshGetLastError: Get error message” on page 150
• “dshClearLastError: Clear last error message ” on page 39
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 149
AR100500-PSA-EN-3
Chapter 3 libdsh function reference
Notes
Function Header
char * dshGetLastError(void *dsh);
Parameters
• dsh (input)
Class handle, obtained via a preceding dshOpen() call.
Return values
Error string of last libdsh function call that has failed
NULL: No error information available (see “Error handling” on page 35).
Example
After evaluating the error situation (see “dshGetLastErrno: Get error
number” on page 148), you may use the code below to provide an error message
for the user:
if (dshDsGetPart(...) == 0) {
char * message = dshGetLastError(dsh);
printf("ERROR: %s\n", message);
dshFree(message);
}
See also the examples in “Archive Server API in practice“ on page 193
Related Functions
150 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
3.45. dshGetLastError: Get error message
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 151
AR100500-PSA-EN-3
Chapter 3 libdsh function reference
Note: Call dshFree() to free the memory buffer that has been allocated for
the returned string.
Function Header
char * dshGetMimeType(
void *dsh,
const char *doc_type,
const char *compid,
const char *comp_type
);
Parameters
• dsh (input)
Class handle, obtained via a preceding dshOpen() call.
• doc_type (input)
Document type.
Specify NULL or "" if unkown.
• compid (input)
Component name.
Specify NULL or "" if unkown.
• comp_type (input)
Component type.
Specify NULL or "" if unkown.
Return values
MIME type on success.
NULL: Error; use the dshGetLastErrno function to obtain further error
information.
Errors that may occur
• DSH_ERR_OUT_OF_MEMORY (11204):
152 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
3.46. dshGetMimeType: Convert to MIME type
Out of memory
For an overview of all error messages, see “libdsh errors” on page 234.
Example
1. Get corresponding MIME type for old component type ALF (without relation
to a concrete document/component):
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 153
AR100500-PSA-EN-3
Chapter 3 libdsh function reference
Notes
• Call dshFree() to free the memory buffer that has been allocated for the
returned string.
• See “Access protection via SecKeys (signed URLs)” on page 22 and
“SecKey handling in libdsh” on page 31 for details on the use of SecKeys.
Function Header
char *dshGetPrivateKeyFile(void);
Parameters
none
Return values
Filename of the private key on success.
NULL: The specified file could not be found (or the function failed due to another,
unknown error).
Example
Get the filename of the private key:
Related Functions
• “dshSetPrivateKey, dshSetPrivateKeyFile: Set private key”
on page 187
154 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
3.48. dshGetProxy: Get proxy server
Note: Call dshFree() to free the memory buffer that has been allocated for
the returned string. Note that even the memory allocated for an empty
returned string must be freed by the calling application.
Function Header
char * dshGetProxy(void *dsh);
Parameters
• dsh (input)
Class handle, obtained via a preceding dshOpen() call.
Return values
Name of the proxy server if set.
Empty string "" if no proxy server has been set before.
Example
Related Functions
• “dshSetProxy: Set proxy server” on page 190
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 155
AR100500-PSA-EN-3
Chapter 3 libdsh function reference
Note: Call dshFree() to free the memory buffer that has been allocated for
the returned string.
Function Header
char * dshGetUser(void *dsh);
Parameters
• dsh (input)
Class handle, obtained via a preceding dshOpen() call.
Return values
User name on success.
NULL on error (Out of memory; not retrievable via dshGetLastErrNo or
dshGetLastError)
Example
Get user name:
Related Functions
• “dshSetUser: Set user name” on page 191
156 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
3.50. dshGetVersion: Get major and minor version number of libdsh
Note: Call dshFree() to free the memory buffer that has been allocated for
the returned build_string parameter.
Function Header
void dshGetVersion(
int *major,
int *minor,
char **build_string
);
Parameters
• major (output)
Major version number of the libdsh library
• minor (output)
Minor version number of the libdsh library
• build_string (output)
Build number string (for example, 4.2.2001.0131)
Return values
No return values
Example
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 157
AR100500-PSA-EN-3
Chapter 3 libdsh function reference
<n> days
Retention is set to <n> days.
Function Header
int dshExtendRetention(
void *dsh,
const char *aid,
const char *docid,
const char *retention
);
Parameters
• dsh (input)
Class handle, obtained via a preceding dshOpen() call
• aid (input)
Archive name
• docid (input)
Document name
• retention (input)
Retention period of document. Value={infinite, event, <n days>}:
infinite: retention set to infinite
event: retention set to event-based
<n days>: retention set to <n> days
Return values
1: Function completed successfully.
0: Error; use the dshGetLastErrno function to obtain further error information
158 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
3.51. dshExtendRetention: Extend retention of a document
• DSH_ERR_HTTP_401 (11006):
HTTP error (unauthorized [401]): Breach of security
• DSH_ERR_HTTP_404 (11008):
HTTP error (not found [404]): Document/component/archive not found
• DSH_ERR_HTTP_500 (11012):
HTTP error (Internal Server Error [500]): Internal error in archive server
• DSH_ERR_HTTP_CONNECTION_BROKEN (11003):
HTTP error: connection was broken
• DSH_ERR_HTTP_UNKNOWN (11004):
HTTP error: unknown error
For an overview of all error messages, see “libdsh errors” on page 234..
Example
Extend retention period of document d1 of archive A1 to 720 days (2 years):
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 159
AR100500-PSA-EN-3
Chapter 3 libdsh function reference
Function Header
int dshIsArchive(
void *dsh,
const char *aid
);
Parameters
• dsh (input)
Class handle, obtained via a preceding dshOpen() call.
• aid (input)
Archive name
Return values
1: The specified archive exists.
2: The specified archive is unknown.
0: Error; use the dshGetLastErrno function to obtain further error information.
• DSH_ERR_HTTP_EMPTY_RESULT (11002):
Wrong (empty) result from archive server
• DSH_ERR_HTTP_400 (11005):
HTTP error (bad request [400]): Unknown function or parameter
• DSH_ERR_HTTP_401 (11006):
HTTP error (unauthorized [401]): Breach of security
• DSH_ERR_HTTP_404 (11008):
HTTP error (not found [404]): Document/component/archive not found
• DSH_ERR_HTTP_409 (11010):
HTTP error (conflict [409]): Document/component/administrat. data is
inaccessible
• DSH_ERR_HTTP_500 (11012):
HTTP error (Internal Server Error [500]): Internal error in archive server
• DSH_ERR_HTTP_CONNECTION_BROKEN (11003):
HTTP error: connection was broken
• DSH_ERR_HTTP_UNKNOWN (11004):
HTTP error: unknown error
For an overview of all error messages, see “libdsh errors” on page 234.
[5] see “Logical archives, pools, storage tiers” on page 12
160 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
3.52. dshIsArchive: Verify existence of an archive
Example
Check the existence of archive A1:
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 161
AR100500-PSA-EN-3
Chapter 3 libdsh function reference
Function Header
int dshIsComp(
void *dsh,
const char *aid,
const char *docid,
const char *compid
);
Parameters
• dsh (input)
Class handle, obtained via a preceding dshOpen() call.
• aid (input)
Archive name
• docid (input)
Document ID
• compid (input)
Component name
Return values
1: The specified component exists.
2: The specified component is unknown.
0: Error; use the dshGetLastErrno function to obtain further error information
• DSH_ERR_ACCESS_FILE (11207):
Error in accessing file
• DSH_ERR_UNKNOWN_ARCHIVE (11206):
Unknown archive
• DSH_ERR_FUNCTION_ARGUMENT (11203):
Wrong function argument (for example, NULL pointer)
• DSH_ERR_HTTP_PARSE_HEADER (11001):
Error in parsing HTTP header
• DSH_ERR_UNKNOWN_COMP (11209):
Unknown component
162 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
3.53. dshIsComp: Verify existence of a component
• DSH_ERR_HTTP_400 (11005):
HTTP error (bad request [400]): Unknown function or parameter
• DSH_ERR_HTTP_401 (11006):
HTTP error (unauthorized [401]): Breach of security
• DSH_ERR_HTTP_404 (11008):
HTTP error (not found [404]): Document/component/archive not found
• DSH_ERR_HTTP_409 (11010):
HTTP error (conflict [409]): Document/component/administrat. data is
inaccessible
• DSH_ERR_HTTP_500 (11012):
HTTP error (Internal Server Error [500]): Internal error in archive server
• DSH_ERR_HTTP_CONNECTION_BROKEN (11003):
HTTP error: connection was broken
• DSH_ERR_HTTP_UNKNOWN (11004):
HTTP error: unknown error
For an overview of all error messages, see “libdsh errors” on page 234.
Example
Check, whether component c1 of document d1, located in archive A1, exists:
Related Functions
• “dshDsInfo: Get info string for document/Component” on page 86
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 163
AR100500-PSA-EN-3
Chapter 3 libdsh function reference
Function Header
int dshIstreamClose(
void *dsh,
void *hd
);
Parameters
• dsh (input)
Class handle, obtained via a preceding dshOpen() call.
• hd (input)
Handle, received from function dshIstreamOpen
Return values
0: success
NULL: Error; use the dshGetLastErrno function to obtain further error
information
• DSH_ERR_FUNCTION_ARGUMENT:
Wrong function argument (for example, NULL pointer)
• DSH_ERR_DELETE_MUTEX:
Cannot delete mutex object
• DSH_ERR_DELETE_EVENT:
Cannot delete event object
For an overview of all error messages, see “libdsh errors” on page 234.
Example
Read component c1 of document d1 in archive A1 using streaming and print
content to stdout (Note: dsh received from dshOpen2):
...
void *hd = dshIstreamOpen(dsh,"A1","d1","c1",NULL);
char buf[1000+1];
int len = 0;
while ( (len=dshIstreamRead(dsh,hd,buf,1000)) > 0 ) {
print("%*s",len,buf);
}
int ret = dshIstreamClose(dsh,hd);
164 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
3.55. dshIstreamOpen, dshIstreamOpen2, dshIstreamOpenPart,
dshIstreamOpenPart2: Open stream for reading a component
Notes
• Call dshIstreamClose() to free context and mutex resources!
• The reading will always stop at the end of the component. Therefore,
you will get less bytes than specified by parameter length if the sum of
offset and length is exceeding the size of component.
Function Header
void * dshIstreamOpen(
void *dsh,
const char *aid,
const char *docid,
const char *compid,
const char *rms
);
void * dshIstreamOpen2(
void *dsh,
const char *aid,
const char *docid,
const char *compid,
const char *rms
const char *origid
);
void * dshIstreamOpenPart(
void *dsh,
const char *aid,
const char *docid,
const char *compid,
int64_t offset,
int64_t length,
const char *rms
const char *origid
);
void * dshIstreamOpenPart2(
void *dsh,
const char *aid,
const char *docid,
const char *compid,
int64_t offset,
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 165
AR100500-PSA-EN-3
Chapter 3 libdsh function reference
int64_t length,
const char *rms
const char *origid
);
Parameters
• dsh (input)
Class handle, obtained via a preceding dshOpen() call.
• aid (input)
Archive name
• docid (input)
Document name
• compid (input)
Component name
• offset (input)
Offset to read from; value must be larger than or equal to 0
• length (input)
Number of bytes to be read; value must be larger than 0
• rms (input)
Access token for Rights Management Services (RMS). For internal use only –
set to NULL.
• origid (input; dshIstreamOpen2, dshIstreamOpenPart,
dshIstreamOpenPart2 only)
Originator of request. Set to "" or NULL if not used.
Return values
Stream handle on success
NULL: Error; use the dshGetLastErrno function to obtain further error
information
166 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
3.55. dshIstreamOpen, dshIstreamOpen2, dshIstreamOpenPart,
dshIstreamOpenPart2: Open stream for reading a component
For an overview of all error messages, see “libdsh errors” on page 234.
Example
Read 10000 bytes, starting at offset 10, from component c1 of document d1 of
archive A1 using streaming and print content to stdout:
...
void *hd = dshIstreamOpenPart(dsh,"A1","d1","c1",10L,
10000L, NULL);
char buf[1000+1];
int len = 0;
while ( (len=dshIstreamRead(dsh,hd,buf,1000)) > 0 ) {
print("%*s",len,buf);
}
int ret = dshIstreamClose(dsh,hd);
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 167
AR100500-PSA-EN-3
Chapter 3 libdsh function reference
Parameters
• dsh (input)
Class handle, obtained via a preceding dshOpen() call.
• context (input)
Context object (handle) received from dshIstreamOpen()
• buf (input)
Buffer to read in, must be allocated by caller
• nbyte (input)
Number of bytes to read from stream and write into buffer buf
Return values
Number of read bytes where special value
0 means EOF reached
-1 means error; use the dshGetLastErrno function to obtain further error
information.
Errors that may occur
• DSH_ERR_ACCESS_FILE (11207):
Error in accessing file
• DSH_ERR_UNKNOWN_ARCHIVE (11206):
Unknown archive
• DSH_ERR_HTTP_400 (11005):
HTTP error (bad request [400]): Unknown function or parameter
• DSH_ERR_HTTP_401 (11006):
HTTP error (unauthorized [401]): Breach of security
• DSH_ERR_HTTP_404 (11008):
HTTP error (not found [404]): Document/component/archive not found
• DSH_ERR_HTTP_409 (11010):
HTTP error (conflict [409]): Document/component/administrat. data is
inaccessible
168 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
3.56. dshIstreamRead: Read opened stream
• DSH_ERR_HTTP_500 (11012):
HTTP error (Internal Server Error [500]): Internal error in archive server
• DSH_ERR_HTTP_CONNECTION_BROKEN (11003):
HTTP error: connection was broken
• DSH_ERR_HTTP_UNKNOWN (11004):
HTTP error: unknown error
• DSH_ERR_HTTP_560_ONTAPE
HTTP error (document not accessible [560]): The document cannot be
accessed because it is on tape.
• DSH_ERR_FUNCTION_ARGUMENT:
Wrong function argument (for example, NULL pointer)
• DSH_ERR_READ_FROM_CLOSED_STREAM
Stream to read from is closed
For an overview of all error messages, see “libdsh errors” on page 234.
Example
Read data via streaming and print result to stdout (dsh received from
dshIstreamOpen()):
...
void *hd = dshIstreamOpen(dsh,"A1","doc1","data",NULL);
char buf[1000+1];
int len = 0;
while ( (len=dshIstreamRead(dsh,hd,buf,1000)) > 0 ) {
print("%*s",len,buf);
}
dshIstreamClose(dsh,hd);
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 169
AR100500-PSA-EN-3
Chapter 3 libdsh function reference
With Archive Server version 9.7, an alternative, more flexible concept has been
introduced to connect to Archive Server, which is reflected by the alternative
function call dshOpen2 in libdsh_3. For programs addressing Archive Server
version 9.7 or higher, you should preferably refer to dshOpen2; dshOpen currently is
still supported, but might be discontinued with a later release.
3.57.1 dshOpen
Purpose
Opens a connection to the ADMS/DS on the primary_host repository server
according to the fixed addressing concept used before Archive Server version
9.7.
If the connection to the primary_host server fails and another server is specified
in secondary_host, libdsh will try to connect to this server instead. You should
also take into account that the server you are trying to connect to may be
temporarily unavailable, for example, due to a short network problem or a boot
process. Therefore you should keep trying to call the function for a certain
period, if the connection establishment fails.
Notes
• The parameters specified in this function call are used only for initially
connecting to Archive Server. As soon as the connection has been
established, libdsh loads a list of the available Archive Servers and refers
to this list later on (for example, if the connection gets lost).
• Call dshClose() at the end of the session/application or when you no
longer need the connection to the primary_host Archive Server.
• If permitted by the server, you may choose the transmission protocol to
be used, in the protocol parameter. But even when you are using the
HTTPS protocol, you must specify the HTTP ports in the respective
parameters, not the HTTPS ports.
• The function also initializes the libdsh library itself, if it is called for the
first time (see also “Initializing and ending a libdsh session” on page 32).
Function Header
void *dshOpen(
const char *primary_host,
const char *secondary_host,
int http_port_adms,
170 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
3.57. dshOpen, dshOpen2: Open connection to repository server
int http_port_ds,
const char *protocol,
const char *user,
const char *application
);
Parameters
• primary_host (input)
Hostname of the next (primary) Archive Server (DS/ADMS)
• secondary_host (input)
Hostname of a secondary (replication) server; specify NULL if no secondary
server is available.
This host will only be connected, if the connection to the primary server fails.
• http_port_adms (input)
HTTP port number of ADMS (do not specify a HTTPS port, see above).
Return values
A handle, which will be needed for the most other libdsh functions, on success.
NULL: An error occurred.
Please note that the dshGetLastErrno and dshGetLastErrorfunctions cannot
be used in this case, as the error information evaluated by these functions is
assigned to a session (dsh handle) which has not yet been established at this
stage.
Example
Open a secure connection (HTTPS protocol) to server misha. The respective
HTTP ports are 4060 for ADMS and 8080 for DS (so the HTTPS ports, which are
actually used for the communication, are 4061 for ADMS and 8090 for DS):
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 171
AR100500-PSA-EN-3
Chapter 3 libdsh function reference
See also the examples in “Archive Server API in practice“ on page 193
Related Functions
• “dshClose: Close connection to repository server” on page 40
3.57.2 dshOpen2
Purpose
Opens a connection to the ADMS/DS on the primary_host repository server
according to the flexible addressing concept introduced with Archive Server
version 9.7.
Notes
• The parameters specified in this function call are used only for initially
connecting to Archive Server. As soon as the connection has been
established, libdsh loads a list of the available Archive Servers and refers
to this list later on (for example, if the connection gets lost).
• Call dshClose() at the end of the session/application or when you no
longer need the connection to the primary_host Archive Server.
• If permitted by the server, you may choose the transmission protocol to
be used, in the protocol parameter. But even when you are using the
HTTPS protocol, you must specify the HTTP ports in the respective
parameters, not the HTTPS ports.
• The function also initializes the libdsh library itself, if it is called for the
first time (see also “Initializing and ending a libdsh session” on page 32).
Function Header
void *dshOpen2(
const char *archive_server,
const char *protocol,
const int port,
const char *url_path,
const char *user,
const char *application
);
Parameters
• archive_server (input)
Hostname of the next (primary) Archive Server (DS/ADMS)
• protocol (input)
Specify "HTTP" for a insecure connection or "HTTPS" for a secure connection
(this setting may be ignored by the server).
• port (input)
172 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
3.57. dshOpen, dshOpen2: Open connection to repository server
Note: If connecting to Archive Server version lower than 9.7, the ADMS
port is automatically assigned to 4060 (HTTP) or 4061 (HTTPS),
respectively, as required for these versions.
Important
If you used the dshOpen call up to now, take care that you refer to
the correct port with HTTPS: You must no longer specify the HTPP
port here, but the actual HTTPS port.
• url_path (input)
Part of the URL that specifies the server to be addressed, including the
leading slash (for example, “/archive”)
• user (input)
User name, required for DS accounting (no validation on the server). If you
specify NULL, libdsh will transmit the hostname of the client to the server.
• application (input)
Application name, required for DS accounting. If you specify NULL, libdsh
will transmit “libdsh” to the server.
Return values
A handle, which will be needed for the most other libdsh functions, on success.
NULL: An error occurred.
Please note that the dshGetLastErrno and dshGetLastErrorfunctions cannot
be used in this case, as the error information evaluated by these functions is
assigned to a session (dsh handle) which has not yet been established at this
stage.
Example
Open a secure connection (HTTPS) to server misha. The respective HTTPS port
is 8090:
Related Functions
• “dshClose: Close connection to repository server” on page 40
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 173
AR100500-PSA-EN-3
Chapter 3 libdsh function reference
Function Header
void dshSetAidRefreshInterval(
void *dsh,
time_t refresh_interval
);
Parameters
• dsh (input)
Class handle, obtained via a preceding dshOpen() call.
• refresh_interval (input)
Specify the refresh interval in seconds.
Return values
No return values
Example
Set the refresh interval to 10 minutes:
dshSetAidRefreshInterval(dsh,"600");
Related Functions
• “dshGetAidRefreshInterval: Get aid refresh interval” on page 129
• “dshSetAidRefreshTime: Set time of next ADMS info refresh”
on page 175
174 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
3.59. dshSetAidRefreshTime: Set time of next ADMS info refresh
Notes
Function Header
void dshSetAidRefreshTime(
void *dsh,
time_t refresh_time
);
Parameters
• dsh (input)
Class handle, obtained via a preceding dshOpen() call.
• refresh_time (input)
Refresh time (in seconds since January 1, 1970, 00:00 h)
Return values
No return values
Example
Set refresh time of next update to “now” + 10 minutes:
#include time.h
time_t refresh_time = time(NULL) + 300;
dshSetAidRefreshTime(dsh,refresh_time);
Related Functions
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 175
AR100500-PSA-EN-3
Chapter 3 libdsh function reference
176 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
3.60. dshSetApplication: Set application name
Function Header
void dshSetApplication(
void *dsh,
const char *application
);
Parameters
• dsh (input)
Class handle, obtained via a preceding dshOpen() call.
• application (input)
Application name to be used for DS accounting.
Return values
No return values
Example
Set application name to IXOS-VIEWER:
dshSetApplication(dsh,"IXOS-VIEWER");
Related Functions
• “dshGetApplication: Get application name” on page 131
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 177
AR100500-PSA-EN-3
Chapter 3 libdsh function reference
Notes
Function Header
void dshSetAuthId(
void *dsh,
const char *auth_id
);
Parameters
• dsh (input)
Class handle, obtained via a preceding dshOpen() call.
• auth_id (input)
Specify the client identifier to be used for SecKey authentification.
Return values
No return values
Example
Set client identifier to C11:
dshSetAuthId(dsh,"C11");
Related Functions
178 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
3.62. dshSetCertificate, dshSetCertificateFile: Set certificate
3.62 dshSetCertificate,
dshSetCertificateFile: Set certificate
Purpose
Introduces the digital certificate into the libdsh library; the digital certificate is
required when accessing documents that are protected via SecKeys.
The certificate may be read either from a memory buffer (dshSetCertificate)
or from a file (dshSetCertificateFile) – see Parameters below for details.
Note: Apart from being introduced locally, the certificate must also be
transferred to the respective repository server via dshDsPutCert or
dshDsPutCertFile before the first document protected via SecKeys can be
requested.
In addition you must specify a private key (via dshSetPriateKey), a client
identifier (via dshSetAuthId) and an expiration time (via
dshSetExpTimeSecKey); these are also required for building SecKey
requests.
See also “Access protection via SecKeys (signed URLs)” on page 22 and
“SecKey handling in libdsh” on page 31 for further details.
Function Header
void dshSetCertificateFile(const char *path);
void dshSetCertificate(
const unsigned char *cert_buf,
int cer_len
);
Parameters
• path (input)
Certificate file to be read; the file must correspond to the PEM standard
(RFC1424, see [2 on page 225] in “Further information sources” on page 225
for details).
• cert_buf (input)
Memory buffer containing the certificate data to be read. The certificate data
must be encoded according to the Distinguished Encoding Rules (DER, see [3
on page 225] in “Further information sources” on page 225).
• cert_len (input)
Length of cert_buf (number of bytes)
Return values
No return values
Example
Read the certificate from the cert.pem file:
dshSetCertificateFile("cert.pem");
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 179
AR100500-PSA-EN-3
Chapter 3 libdsh function reference
Related Functions
• “dshGetCertificateFile: Get filename of certificate” on page 133
• “dshDsPutCert, dshDsPutCertFile: Put certificate to Archive Server”
on page 94
• “dshGetAuthId: Get authenticity ID of client” on page 132
• “dshSetPrivateKey, dshSetPrivateKeyFile: Set private key”
on page 187
• “dshSetExpTimeSecKey: Set expiration time for SecKey” on page 182
• “dshSetCertificate, dshSetCertificateFile: Set certificate ”
on page 179
180 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
3.63. dshSetConfig: Set value of global configuration variable
Note: Call dshFree() to free the memory buffer that has been allocated for
the returned string.
Function Header
int dshSetConfig(
void *dsh,
const char *key,
const char *value
);
Parameters
• dsh (input)
Class handle, obtained via a preceding dshOpen() call.
• key (input)
Name of the variable to be set
• value (input)
Value to be set
Return values
1: Function completed successfully.
2: Invalid key parameter
3: Invalid value parameter
0: Other error
Example
Set value on for the global HTTP log-setting LOG_DSH:
Related Functions
• “dshGetConfig: Get value of global configuration variable” on page 139
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 181
AR100500-PSA-EN-3
Chapter 3 libdsh function reference
Note: Apart from setting the expiration time, further settings are required
before you can access documents that are protected via SecKeys. See also
“Access protection via SecKeys (signed URLs)” on page 22 and “SecKey
handling in libdsh” on page 31 for further details.
Function Header
void dshSetExpTimeSecKey(
void *dsh,
int seconds
);
Parameters
• dsh (input)
Class handle, obtained via a preceding dshOpen() call.
• seconds (input)
Expiration time for SecKey requests (in seconds)
Return values
No return values
Example
Set the expiration time for SecKey requests to 10 minutes:
dshSetExpTimeSecKey(dsh,600);
Related Functions
182 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
3.65. dshSetLogFile: Set log file
Important
• See “Logging” on page 32 for further details on logging.
• This function redirects the STDERR stream to the specified file. As a
consequence, all output sent to STDERR by your own application is
written to the log file, too.
Function Header
int dshSetLogFile(const char *file);
Parameters
• file (input)
Path and file name of the log file to be used. Both an absolute path
specification or a relative path specification (related to the working directory
of your application) are admissible.
Return values
1: Function completed successfully.
0: An error occurred.
Please note that the dshGetLastErrno and dshGetLastError functions cannot
be used in this case, as the error information evaluated by these functions is
assigned to a session (dsh handle) which has not yet been established at this
stage.
Example
Set log file to libdsh.txt:
dshSetLogFile("libdsh.txt");
Related Functions
• “dshSetLogMaxSize: Set maximum size of log file” on page 186
• “dshSetLogLevel: Set log level” on page 184
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 183
AR100500-PSA-EN-3
Chapter 3 libdsh function reference
Important
Function Header
int dshSetLogLevel(
const char *level,
const char *on_or_off
);
Parameters
• level (input)
Log channel to be enabled or disabled:
INFO for information messages
DEBUG for debug messages
ENTRY for function entries (each function call is logged)
• on_or_off (input)
Specify on for enabling the channel specified in level
Specify off for disabling the channel specified in level
Return values
1: Function completed successfully.
0: An error occurred.
Please note that the dshGetLastErrno and dshGetLastError functions cannot
be used in this case, as the error information evaluated by these functions is
assigned to a session (dsh handle) which has not yet been established at this
stage.
Example
Enable all log channels (full logging):
dshSetLogLevel("INFO","on");
dshSetLogLevel("DEBUG","on");
dshSetLogLevel("ENTRY","on");
Related Functions
184 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
3.66. dshSetLogLevel: Set log level
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 185
AR100500-PSA-EN-3
Chapter 3 libdsh function reference
Important
Function Header
int dshSetMaxLogSize(unsigned long size);
Parameters
• size (input)
Maximum size of the log file in bytes.
Return values
1: Function completed successfully.
0: An error occurred.
Please note that the dshGetLastErrno and dshGetLastError functions cannot
be used in this case, as the error information evaluated by these functions is
assigned to a session (dsh handle) which has not yet been established at this
stage.
Example
Example: Set maximum size of the log file to 5 MB:
dshSetMaxLogSize(5242880);
Related Functions
186 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
3.68. dshSetPrivateKey, dshSetPrivateKeyFile: Set private key
Note: Apart from setting the private key, further settings are required
before you can access documents that are protected via SecKeys. See also
“Access protection via SecKeys (signed URLs)” on page 22 and “SecKey
handling in libdsh” on page 31 for further details.
Function Header
void dshSetPrivateKeyFile(const char *path);
void dshSetPrivateKey(
const unsigned char *key_buf,
int key_len
);
Parameters
• path (input)
Private key file; the file must correspond to the PEM standard (RFC1424, see
[2 on page 225] in “Further information sources” on page 225 for details).
• cert_buf (input)
Private key; the data must be encoded according to the Distinguished
Encoding Rules (DER, see [3 on page 225] in “Further information sources”
on page 225).
• cert_len (input)
Length of private key (in number of bytes)
Return values
No return values
Example
Read the private key from the key.pem file:
dshSetPrivateKeyFile("key.pem");
Related Functions
• “dshGetPrivateKeyFile: Get filename of private key” on page 154
• “dshGetAuthId: Get authenticity ID of client” on page 132
• “dshSetCertificate, dshSetCertificateFile: Set certificate ”
on page 179
• “dshSetExpTimeSecKey: Set expiration time for SecKey” on page 182
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 187
AR100500-PSA-EN-3
Chapter 3 libdsh function reference
188 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
3.69. dshSetPrivateKeyPassphrase: Set passphrase to decrypt encrypted private key
file
Function Header
void dshSetPrivateKeyPassphrase(const char *passphrase);
Parameters
• passphrase (input)
passphrase to decrypt the encrypted private key file
Return values
No return values
Example
The private key file was encrypted with “ixos”:
dshSetPrivateKeyPassphrase("ixos");
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 189
AR100500-PSA-EN-3
Chapter 3 libdsh function reference
Notes
• Use the dshGetProxy function to get the current proxy server setting.
• If you want to abort the communication via the proxy server, call
dshSetProxy again and specify the empty string ("") in the proxy
parameter.
Function Header
void dshSetProxy(
void *dsh,
const char *proxy
);
Parameters
• dsh (input)
Class handle, obtained via a preceding dshOpen() call.
• proxy (input)
Specify the proxy server to be used, for example, "http://misha:8080".
Return values
No return values
Example
dshSetProxy(dsh,"http://misha:8080");
Related Functions
• “dshGetProxy: Get proxy server” on page 155
190 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
3.71. dshSetUser: Set user name
Note: Use the dshGetUser() function to retrieve the current user name
setting.
Function Header
void dshSetUser(
void *dsh,
const char *user
);
Parameters
• dsh (input)
Class handle, obtained via a preceding dshOpen() call.
• user (input)
Specify the user name, needed for DS accounting
Return values
No return values
Example
Set user name to Gabriel:
dshSetUser(dsh,"Gabriel");
Related Functions
• “dshGetUser: Get user name” on page 156
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 191
AR100500-PSA-EN-3
Chapter 4
Archive Server API in practice
To give you a better idea of how to use libdsh and its functions, this chapter
provides a range of C++ example programs, each of which deals with a specific task,
for example, storing a document in the archive or dealing with document and
component attributes.
Started from The purpose of these example programs is to give you an introduction; therefore
command line they are quite simple and do not provide any comfort as a user would expect today
(but it may be your first exercise to add this comfort...); this also means that they
have no GUI, but are started from a command line.
Basics Before going into detail on the individual programs in “Sample programs in detail”
on page 198, the next two sections provide more basic descriptions:
• “Preparations” on page 194 tells you how to prepare the compilation of libdsh
programs on the supported platforms, for example, include files, linking
preconditions. It also tells you how to get the source code files of the sample
programs and other files that are required for you to compile your applications.
• “Basic structure of the sample programs” on page 197: As all sample programs
have a similar structure, this basic framework is presented in a separate section.
Specific details are described then in the individual program sections.
Equal for all Apart from the linking and compilation differences described in “Preparations”
platforms on page 194, the programs do not apply to a specific platform (operating system), so
you may use them on any supported platform.
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 193
AR100500-PSA-EN-3
Chapter 4 Archive Server API in practice
4.1 Preparations
4.1.1 Files accompanying this manual
This manual is accompanied by a set of files, that comprise the sample programs as
well as a range of include files, library files and other files required in using the
libdsh library.
KC These files are delivered in a ZIP file libdsh_sdk.zip, which is available for
download from the OpenText Knowledge Center (https://knowledge.opentext.com/
knowledge/llisapi.dll/Open/14841258). Note that you need a separate license to use
this API and thus to access these files.
Structure of Unpack this file in an empty directory anywhere on your hard disk; advice the unzip
serv- tool to maintain the folder structure. A libdsh_sdkfolder is generated that contains
er_API_SDK
a subfolder for each platform supported by libdsh. Within each platform, you will
find the usual structure for auxiliary files such as *.h header files and stub files (see
also next sections). Each platform subfolder also contains an examples subfolder
providing the source files of the sample programs described in “Sample programs in
detail” on page 198. These source code files are identical for all platform apart from
OS-specific differences (end-of-line mark). Even a simple make file is provided for a
common development environment on each platform; this enables you to quickly
compile a program.
Note: For compatibility reasons, most library and link files of software version
9.7 and higher are provided in a new version 3 now, instead of the former
version 2 (or even 1). If you have software projects from older API versions,
please do not forget to update these references, as the version is part of the file
names. See also “Library files” on page 195.
...
#include "inlcude/libdsh/libdsh.h"
...
int main(int argc, char **argv)
{
...
}
Within the sample program structure of the libdsh_sdk folder, the include file is
located in the include subfolder of the respective platform folder:
libdsh_sdk/<platform>/include/libdsh/libdsh.h
194 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
4.1. Preparations
The following table lists both the file names of the DLL/shared library and the
environment variable described above for each supported platform.
Within the sample program structure of the libdsh_sdk folder, the library files are
located in the lib subfolder of the respective platform folder:
libdsh_sdk/<platform>/lib/...
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 195
AR100500-PSA-EN-3
Chapter 4 Archive Server API in practice
4.1.4 Linking
To adapt the platform-independent libdsh library to the platform-specific
communication, a stub file is required to link your applications. The following table
lists the respective stub file name for each supported platform as well as the specific
link command and options for a commonly used linker program; foo represents
your program.
Note that only the Windows platform requires that you provide the stub file; on
UNIX platforms, the stub information is provided by the shared libraries, which
must therefore be linked with your application.
Within the sample program structure of the libdsh_sdk folder, the stub file for
Windows is located in the libdsh_sdk/windows/lib folder (see also “Files
accompanying this manual” on page 194).
Platform/OS libdsh library stub files Link program (foo) with libdsh
for linking
Linker
Windows PC / libdsh_3MD.lib link foo.obj
(Windows2003) libdsh_3MD.lib
196 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
4.2. Basic structure of the sample programs
Platform/OS libdsh library stub files Link program (foo) with libdsh
for linking
Linker
IBM / AIX (64 Bit) Link to libdsh_3.so shared xlC ‑o foo*.o libdsh_3.so
library, which provides the
IBM link with xlC stub information
Note: It may happen, that dshExit cannot release resources that have been
allocated directly by your application, due to different ownership.
Therefore, you should always explicitly release resources you have
allocated: Apply the dshFree function to resources allocated by a libdsh
function, and the free standard function on other resources (see also
“Function parameters and return values” on page 36).
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 197
AR100500-PSA-EN-3
Chapter 4 Archive Server API in practice
Note: The Test steps section relates to a Sun Solaris (UNIX) environment, but is
valid in principle for any supported platform.[1] The only differences are a
different way of calling the compiler in the first step of the section (see “Library
files” on page 195) and a different means of declaring the shared library
directory to your OS environment in the second step (“Linking” on page 196).
Each section deals with one sample program, each demonstrating a certain kind of
application. The source code for all sample programs is available as separate files, so
you need not re-type them (see “Files accompanying this manual” on page 194). You
can to modify the sample programs for learning or to reuse parts of the code in your
own applications.
Important
If possible, you should not use a life system storing relevant data for learning
or for testing your applications; if you do, you risk losing data and even
entire documents!
If you cannot use a separate system for testing, ask the administrator of your
archive system to establish a separate logical archive for your purposes and
use this archive exclusively.
[1] By the way: The “%” character used in the examples is the standard command prompt.
198 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
4.3. Sample programs in detail
Note: Note that the first component usually is interpreted as the main
component (see “Main component” on page 15). Therefore always store the
main component at first.
Usage
dsh_put ‑h <host> ‑a <aid> ‑f {<file>} [-d <docid>]
Options:
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 199
AR100500-PSA-EN-3
Chapter 4 Archive Server API in practice
28 }
29 //---------------
30 // get archive id
31 //---------------
32 } else if ( strcmp(argv[i],"-a") == 0 ) {
33 if ( ++i < argc ) {
34 strcpy(aid,argv[i++]);
35 }
36 //---------------------
37 // get docid (optional)
38 //---------------------
39 } else if ( strcmp(argv[i],"-d") == 0 ) {
40 if ( ++i < argc ) {
41 strcpy(docid,argv[i++]);
42 }
43 //----------
44 // get files
45 //----------
46 } else if ( strcmp(argv[i],"-f") == 0 ) {
47 while ( (++i < argc) && (nr_files<10) ) {
48 if ( *argv[i] == '-' ) {
49 break;
50 }
51 strcpy(file[nr_files++],argv[i]);
52 }
53 } else {
54 printf("wrong program parameter\n");
55 break;
56 }
57 }
58 //--------------------------
59 // verify program parameters
60 //--------------------------
61 if ( (strlen(host) == 0) ||
62 (strlen(aid) == 0) ||
63 (strlen(file[0]) == 0) ) {
64 printf("\n");
65 printf("usage: %s -h <host> -a <aid> -f {<file>} [-d <docid>]\n",
66 argv[0]);
67 printf("\n");
68 printf("options:\n");
69 printf(" -h <host> hostname <host> of archive server.\n");
70 printf(" -a <aid> archive.\n");
71 printf(" -f {<file>} source file[s] to archive.\n");
72 printf(" -d <docid> optional: document id\n");
73 printf("\n");
74 printf("description: archive files in a document. The filename\n");
75 printf(" will also be taken as component name.\n");
76 printf("\n");
77 return 1;
78 }
79
80 //----------------------
81 // initialize Server API
82 //----------------------
83 void *dsh = dshOpen(host,NULL,4060,8080,"http","user",*argv);
84 if ( dsh == NULL ) {
85 //-----------------------------
86 // archive server not reachable
87 //-----------------------------
88 printf("error: archive server '%s' not reachable\n",host);
89 return 1;
90 }
91
92 //----------------------------
93 // store files in one document
94 //----------------------------
95 for ( int j=0; j<nr_files; j++ ) {
96 if ( (ret=dshDsCreateFile(dsh,aid,docid,file[j],
97 "application/octet-stream",file[j],"")) == 0 ) {
98 //--------------------
99 // print error message
100 //--------------------
101 printf("error: %s\n",dshGetLastError(dsh));
102 return 1;
103 }
104 }
105
200 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
4.3. Sample programs in detail
106 //----------------
107 // free Server API
108 //----------------
109 dshClose(dsh);
110 dshExit();
111
112 printf("file[s] successfully archived in document '%s'\n",docid);
113 return 0;
114 }
115
1. Create program:
CC ‑o dsh_put dsh_put.cxx libdsh_3.so
2. Append the directory, where you have placed the shared libraries, to the
LD_LIBRARY_PATH variable (see also “Library files” on page 195).
% set LD_LIBRARY_PATH[2]="$LD_LIBRARY_PATH;<path to shared libs>"
% export LD_LIBRARY_PATH
3. Send two files file1 and file2 to the A1 archive on the host1 server:
[2] Variable name for other platforms see “Library files” on page 195.
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 201
AR100500-PSA-EN-3
Chapter 4 Archive Server API in practice
202 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
4.3. Sample programs in detail
40 strcpy(docid,argv[i++]);
41 }
42 //-------------------------------
43 // i-option (only show comp-info)
44 //-------------------------------
45 } else if ( strcmp(argv[i],"-i") == 0 ) {
46 i_option_flag = 1;
47 ++i;
48 } else {
49 printf("wrong program parameter\n");
50 break;
51 }
52 }
53 //--------------------------
54 // verify program parameters
55 //--------------------------
56 if ( (strlen(host) == 0) ||
57 (strlen(aid) == 0) ||
58 (strlen(docid) == 0) ) {
59 printf("\n");
60 printf("usage: %s -h <host> -a <aid> -d <docid> [-i]\n",argv[0]);
61 printf("\n");
62 printf("options:\n");
63 printf(" -h <host> hostname of archive server.\n");
64 printf(" -a <aid> archive.\n");
65 printf(" -d <docid> document id.\n");
66 printf(" -i optional: only print component information.\n");
67 printf("\n");
68 printf("description: get all files/components of a document \n");
69 printf(" and print component information to stdout.\n");
70 printf(" If i-option set, we only display information.\n");
71 printf("\n");
72 return 1;
73 }
74
75 //----------------------
76 // initialize Server API
77 //----------------------
78 void *dsh = dshOpen(host,NULL,4060,8080,"http","user",*argv);
79 if ( dsh == NULL ) {
80 //-----------------------------
81 // archive server not reachable
82 //-----------------------------
83 printf("error: archive server '%s' not reachable\n",host);
84 return 1;
85 }
86
87 //---------------------------------------------------
88 // get all components and print information to stdout
89 //---------------------------------------------------
90 char *info = dshDsInfo(dsh,aid,docid,"");
91 if ( info == NULL ) {
92 printf("error: can't get info of document '%s': %s\n",docid,
93 dshGetLastError(dsh));
94 return 1;
95 }
96 char *name;
97 char *status;
98 char *type;
99 char *c_date;
100 char *c_time;
101 char *m_date;
102 char *m_time;
103 char *length;
104 int version;
105 char *vol_name;
106 char *sig_object;
107 int heading_flag = 0;
108 while( (ret=dshCompInfo(dsh,&info,0,&name,&status,&type,
109 &c_date,&c_time,&m_date,&m_time,
110 &length,&version,&vol_name,&sig_object)) == 1 ) {
111 //----------------------------
112 // print component information
113 //----------------------------
114 if ( heading_flag == 0 ) {
115 heading_flag = 1;
116 printf("Status Date Time Size Type "
117 " Name\n");
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 203
AR100500-PSA-EN-3
Chapter 4 Archive Server API in practice
118 printf("-----------------------------------------"
119 "---------------------------\n");
120 }
121 printf("%-8s %-8s %-6s %-8s %-24s %s\n",status,c_date,c_time,length,
122 type,name);
123 if ( i_option_flag == 1 ) {
124 //--------------------
125 // don't get component
126 //--------------------
127 dshFree(name);
128 dshFree(status);
129 dshFree(type);
130 dshFree(c_date);
131 dshFree(c_time);
132 dshFree(m_date);
133 dshFree(m_time);
134 dshFree(length);
135 dshFree(vol_name);
136 dshFree(sig_object);
137 continue;
138 }
139 //----------------------------
140 // get component (no i-option)
141 //----------------------------
142
143 if ( dshDsGetFile(dsh,aid,docid,name,name) == 0 ) {
144 printf("error: can't get component '%s' of document '%s': %s\n",
145 name,docid,dshGetLastError(dsh));
146 dshFree(save_info);
147 dshFree(name);
148 dshFree(status);
149 dshFree(type);
150 dshFree(c_date);
151 dshFree(c_time);
152 dshFree(m_date);
153 dshFree(m_time);
154 dshFree(length);
155 dshFree(vol_name);
156 dshFree(sig_object);
157 return 1;
158 }
159 dshFree(name);
160 dshFree(status);
161 dshFree(type);
162 dshFree(c_date);
163 dshFree(c_time);
164 dshFree(m_date);
165 dshFree(m_time);
166 dshFree(length);
167 dshFree(vol_name);
168 dshFree(sig_object);
169 }
170 if ( ret == 0 ) {
171 printf("error: can't get component status of document '%s': %s\n",
172 docid,dshGetLastError(dsh));
173 return 1;
174 }
175
176 //----------------
177 // free Server API
178 //----------------
179 dshClose(dsh);
180 dshExit();
181
182 return 0;
183
1. Create program:
CC ‑o dsh_get dsh_get.cxx libdsh_3.so
2. Append the directory, where you have placed the shared libraries, to the
LD_LIBRARY_PATH variable (see also “Library files” on page 195).
204 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
4.3. Sample programs in detail
3. Get all files/components of the document <docid> that you sent to the
archive in the dsh_put example page 201:
4. Get the name, file size and type, and archiving date and time for all
components of this document, without loading the components themselves
(-i option):
[4] Variable name for other platforms see “Library files” on page 195.
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 205
AR100500-PSA-EN-3
Chapter 4 Archive Server API in practice
Usage
dsh_append ‑h <host> ‑a <aid> ‑d <docid> ‑c <comp> -f <file>
Options:
206 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
4.3. Sample programs in detail
38 } else if ( strcmp(argv[i],"-d") == 0 ) {
39 if ( ++i < argc ) {
40 strcpy(docid,argv[i++]);
41 }
42 //--------------
43 // get component
44 //--------------
45 } else if ( strcmp(argv[i],"-c") == 0 ) {
46 if ( ++i < argc ) {
47 strcpy(compid,argv[i++]);
48 }
49 //-------------------
50 // get file to append
51 //-------------------
52 } else if ( strcmp(argv[i],"-f") == 0 ) {
53 if ( ++i < argc ) {
54 strcpy(file,argv[i++]);
55 }
56 } else {
57 printf("wrong program parameter\n");
58 break;
59 }
60 }
61 //--------------------------
62 // verify program parameters
63 //--------------------------
64 if ( (strlen(host) == 0) ||
65 (strlen(aid) == 0) ||
66 (strlen(docid) == 0) ||
67 (strlen(compid) == 0) ||
68 (strlen(file) == 0) ) {
69 printf("\n");
70 printf("usage: %s -h <host> -a <aid> -d <docid> -c <comp> -f <file>\n",
71 argv[0]);
72 printf("\n");
73 printf("options:\n");
74 printf(" -h <host> hostname of archive server.\n");
75 printf(" -a <aid> archive.\n");
76 printf(" -d <docid> document id.\n");
77 printf(" -c <comp> destination component.\n");
78 printf(" -f <file> source file.\n");
79 printf("\n");
80
81 printf("description: append file <file> to archived component\n");
82 printf(" <comp> of document <docid>\n");
83 printf("\n");
84 return 1;
85 }
86
87 //----------------------
88 // initialize Server API
89 //----------------------
90 void *dsh = dshOpen(host,NULL,4060,8080,"http","user",*argv);
91 if ( dsh == NULL ) {
92 //-------------------
93 // host not reachable
94 //-------------------
95 printf("error: archive server '%s' not reachable\n",host);
96 return 1;
97 }
98
99 //-------------------------
100 // append file to component
101 //-------------------------
102 if ( dshDsAppendFile(dsh,aid,docid,compid,file) == 0 ) {
103 printf("error: can't append file: %s\n",dshGetLastError(dsh));
104 return 1;
105 }
106
107 //----------------
108 // free Server API
109 //----------------
110 dshClose(dsh);
111 dshExit();
112
113 return 0;
114
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 207
AR100500-PSA-EN-3
Chapter 4 Archive Server API in practice
1. Create program:
CC ‑o dsh_append dsh_append.cxx libdsh_3.so
2. Append the directory, where you have placed the shared libraries, to the
LD_LIBRARY_PATH variable (see also “Library files” on page 195).
% set LD_LIBRARY_PATH[5]="$LD_LIBRARY_PATH;<path to shared libs>"
% export LD_LIBRARY_PATH
3. Read the contents of the file4 file to a memory buffer. Then append the
contents of this memory buffer to the file1 component of the document
<docid> that you sent to the archive in the dsh_put example page 201:
[5] Variable name for other platforms see “Library files” on page 195.
208 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
4.3. Sample programs in detail
Note: If you operate in an OpenText TCP system, but want to keep the
attribute naming as used in archive-centric systems, a name mapping must
be defined via the Server Configuration.
Usage
usage: dsh_attribute ‑h<host> ‑a <aid> ‑d<docid> [-c <comp>]
( [-g [<attr>]] | [-s <attr>=<value>] | [-r <attr>] )
Options:
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 209
AR100500-PSA-EN-3
Chapter 4 Archive Server API in practice
24 //-------------------------
25 while( i < argc ) {
26 //------------------------
27 // get archive server name
28 //------------------------
29 if ( strcmp(argv[i],"-h") == 0 ) {
30 if ( ++i < argc ) {
31 strcpy(host,argv[i++]);
32 }
33 //---------------
34 // get archive id
35 //---------------
36 } else if ( strcmp(argv[i],"-a") == 0 ) {
37 if ( ++i < argc ) {
38 strcpy(aid,argv[i++]);
39 }
40 //----------
41 // get docid
42 //----------
43 } else if ( strcmp(argv[i],"-d") == 0 ) {
44 if ( ++i < argc ) {
45 strcpy(docid,argv[i++]);
46 }
47 //--------------
48 // get attribute
49 //--------------
50 } else if ( strcmp(argv[i],"-g") == 0 ) {
51 get_flag = 1;
52 if ( ++i < argc ) {
53 if ( *argv[i] != '-' ) {
54 strcpy(attr,argv[i++]);
55 }
56 }
57 //---------------------------------------
58 // set attribute (-s <attribute>=<value>)
59 //---------------------------------------
60 } else if ( strcmp(argv[i],"-s") == 0 ) {
61 set_flag = 1;
62 if ( ++i < argc ) {
63 char *cp = strchr(argv[i],'=');
64 if ( cp != NULL ) {
65 strncpy(attr,argv[i],cp-argv[i]);
66 strcpy(attr_value,cp+1);
67 }
68 i++;
69 }
70 //-----------------
71 // delete attribute
72 //-----------------
73 } else if ( strcmp(argv[i],"-r") == 0 ) {
74 del_flag = 1;
75 if ( ++i < argc ) {
76 strcpy(attr,argv[i++]);
77 }
78 //-------------------------
79 // get component (optional)
80 //-------------------------
81 } else if ( strcmp(argv[i],"-c") == 0 ) {
82 if ( ++i < argc ) {
83 strcpy(compid,argv[i++]);
84 }
85 } else {
86 printf("wrong program parameter\n");
87 break;
88 }
89 }
90 //--------------------------
91 // verify program parameters
92 //--------------------------
93 if ( (strlen(host) == 0) ||
94 (strlen(aid) == 0) ||
95 (strlen(docid) == 0) ||
96 (set_flag + get_flag + del_flag != 1 ) ) {
97 printf("\n");
98 printf("usage: %s -h <host> -a <aid> -d <docid> [-c <comp>] \n"
99 " ([-g [<attr>]]|[-s <attr>=<value>]|[-r <attr>])"
100 "\n",argv[0]);
101 printf("\n");
210 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
4.3. Sample programs in detail
102 printf("options:\n");
103 printf(" -h <host> hostname <host> of archive server.\n");
104 printf(" -a <aid> archive.\n");
105 printf(" -d <docid> document id.\n");
106 printf(" -c <comp> optional: component name.\n");
107 printf(" -g [<attr>] get attribute. Get all attributes,\n");
108 printf(" if <attr> was not specified.\n");
109 printf(" -s <attr>=<value> set (change) attribute.\n");
110 printf(" -r <attr> delete attribute.\n");
111 printf("\n");
112 printf("description: get/set/delete attribute(s) of a document\n");
113 printf(" (no c-option) or a component (c-option).\n");
114 printf("\n");
115 return 1;
116 }
117
118 //----------------------
119 // initialize Server API
120 //----------------------
121 void *dsh = dshOpen(host,NULL,4060,8080,"http","user",*argv);
122 if ( dsh == NULL ) {
123 //-----------------------------
124 // archive server not reachable
125 //-----------------------------
126 printf("error: archive server '%s' not reachable\n",host);
127 return 1;
128 }
129
130 //-----------------
131 // get attribute(s)
132 //-----------------
133 if ( get_flag == 1 ) {
134 char *pattr;
135 if ( (pattr=dshDsGetAttribute(dsh,aid,docid,compid,attr)) == NULL ) {
136 //--------------------
137 // print error message
138 //--------------------
139 printf("error: %s\n",dshGetLastError(dsh));
140 return 1;
141 }
142 printf("%s\n",pattr);
143 dshFree(pattr);
144
145 //--------------
146 // set attribute
147 //--------------
148 } else if ( set_flag == 1 ) {
149 if ((ret=dshDsSetAttribute(dsh,aid,docid,compid,attr,attr_value))==0){
150 //--------------------
151 // print error message
152 //--------------------
153 printf("error: %s\n",dshGetLastError(dsh));
154 return 1;
155 }
156
157 //-----------------
158 // delete attribute
159 //-----------------
160 } else {
161 if ( (ret=dshDsDelAttribute(dsh,aid,docid,compid,attr)) == 0 ) {
162 //--------------------
163 // print error message
164 //--------------------
165 printf("error: %s\n",dshGetLastError(dsh));
166 return 1;
167 }
168 }
169
170 //----------------
171 // free Server API
172 //----------------
173 dshClose(dsh);
174 dshExit();
175
176 return 0;
177 }
178
179
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 211
AR100500-PSA-EN-3
Chapter 4 Archive Server API in practice
1. Create program:
CC ‑o dsh_attribute dsh_attribute.cxx libdsh_3.so
2. Append the directory, where you have placed the shared libraries, to the
LD_LIBRARY_PATH variable (see also “Library files” on page 195).
% set LD_LIBRARY_PATH[6]="$LD_LIBRARY_PATH;<path to shared libs>"
% export LD_LIBRARY_PATH
7. Again, retrieve all attributes of the document (the Author attribute should
no longer be listed):
% dsh_attribute ‑h host1 ‑a A1 ‑d <docid> ‑g
Version="1.0";
%
8. Create a new attribute Age with value 5 for the file1 component of the
document:
[6] Variable name for other platforms see “Library files” on page 195.
212 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
4.3. Sample programs in detail
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 213
AR100500-PSA-EN-3
Chapter 4 Archive Server API in practice
Usage
usage: dsh_search ‑h <host> ‑a <aid> ‑d <docid> ‑c <comp> ‑p <pattern>
[-n <bytes>]
Options:
214 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
4.3. Sample programs in detail
35 strcpy(aid,argv[i++]);
36 }
37 //----------
38 // get docid
39 //----------
40 } else if ( strcmp(argv[i],"-d") == 0 ) {
41 if ( ++i < argc ) {
42 strcpy(docid,argv[i++]);
43 }
44 //--------------
45 // get component
46 //--------------
47 } else if ( strcmp(argv[i],"-c") == 0 ) {
48 if ( ++i < argc ) {
49 strcpy(compid,argv[i++]);
50 }
51 //------------
52 // get pattern
53 //------------
54 } else if ( strcmp(argv[i],"-p") == 0 ) {
55 if ( ++i < argc ) {
56 strcpy(pattern,argv[i++]);
57 }
58 //-----------------------
59 // number of bytes to get
60 //-----------------------
61 } else if ( strcmp(argv[i],"-n") == 0 ) {
62 if ( ++i < argc ) {
63 nr_of_bytes = atoi(argv[i++]);
64 }
65 } else {
66 printf("wrong program parameter\n");
67 break;
68 }
69 }
70 //--------------------------
71 // verify program parameters
72 //--------------------------
73 if ( (strlen(host) == 0) ||
74 (strlen(aid) == 0) ||
75 (strlen(docid) == 0) ||
76 (strlen(compid) == 0) ||
77 (strlen(pattern) == 0) ) {
78 printf("\n");
79 printf("usage: %s -h <host> -a <aid> -d <docid> -c <comp>\n",argv[0]);
80 printf(" -p <pattern> [-n <bytes>]\n");
81 printf("\n");
82 printf("options:\n");
83 printf(" -h <host> hostname <host> of archive server.\n");
84 printf(" -a <aid> archive.\n");
85 printf(" -d <docid> document id.\n");
86 printf(" -c <comp> component name.\n");
87 printf(" -p <pattern> search pattern.\n");
88 printf(" -n <bytes> number of bytes to get (default=10)\n");
89 printf("\n");
90 printf("description: search for a pattern in a component. On \n");
91 printf(" success we will print some bytes (<bytes>)\n");
92 printf(" of the found passages from component.\n");
93 printf("\n");
94 return 1;
95 }
96
97 //----------------------
98 // initialize Server API
99 //----------------------
100 void *dsh = dshOpen(host,NULL,4060,8080,"http","user",*argv);
101 if ( dsh == NULL ) {
102 //-----------------------------
103 // archive server not reachable
104 //-----------------------------
105 printf("error: archive server '%s' not reachable\n",host);
106 return 1;
107 }
108
109 //------------------------------------
110 // search for pattern (case sensitive)
111 //------------------------------------
112 char *result;
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 215
AR100500-PSA-EN-3
Chapter 4 Archive Server API in practice
113 if ( (result=dshDsSearch(dsh,aid,docid,compid,pattern,0,-1,20,1))==NULL ) {
114 //--------------------
115 // print error message
116 //--------------------
117 printf("error: %s\n",dshGetLastError(dsh));
118 return 1;
119 }
120
121 //---------------------------------------------
122 // parse search result and print found passages
123 //---------------------------------------------
124 char *cp = result;
125 for ( int j=atoi(cp); j>0; j-- ) {
126 //----------------------
127 // get next found offset
128 //----------------------
129 if ( ((cp=strchr(cp,';')) == NULL) || (++cp == '\0') ) {
130 break;
131 }
132 size_t offset = atoi(cp);
133
134 //----------------------------
135 // get and print found passage
136 //----------------------------
137 char *buffer = NULL;
138 int size;
139 if ( dshDsGetPart(dsh,aid,docid,compid,offset,
140 nr_of_bytes,&buffer,&size) == 0 ) {
141 //--------------------
142 // print error message
143 //--------------------
144 printf("error: %s\n",dshGetLastError(dsh));
145 return 1;
146 }
147 printf("offset=%ld size=%d passage='%s'\n",offset,size,buffer);
148
149 //-----------------
150 // free data buffer
151 //-----------------
152 dshFree(buffer);
153 }
154
155 //-------------------
156 // free search result
157 //-------------------
158 dshFree(result);
159
160 //----------------
161 // free Server API
162 //----------------
163 dshClose(dsh);
164 dshExit();
165
166 return 0;
167 }
168
169
1. Create program:
CC ‑o dsh_search dsh_search.cxx libdsh_3.so
2. Append the directory, where you have placed the shared libraries, to the
LD_LIBRARY_PATH variable (see also “Library files” on page 195).
% set LD_LIBRARY_PATH[7]="$LD_LIBRARY_PATH;<path to shared libs>"
% export LD_LIBRARY_PATH
[7] Variable name for other platforms see “Library files” on page 195.
216 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
4.3. Sample programs in detail
Write down (copy/paste) the returned Document ID for use in the next step.
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 217
AR100500-PSA-EN-3
Chapter 4 Archive Server API in practice
218 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
4.3. Sample programs in detail
40 //----------
41 } else if ( strcmp(argv[i],"-d") == 0 ) {
42 if ( ++i < argc ) {
43 strcpy(docid,argv[i++]);
44 }
45 //---------------------------------------------
46 // lock document (optional: with locker string)
47 //---------------------------------------------
48 } else if ( strcmp(argv[i],"-l") == 0 ) {
49 lock_flag = 1;
50 if ( ++i < argc ) {
51 if ( *argv[i] != '-' ) {
52 strcpy(locker,argv[i++]);
53 }
54 }
55 //-----------------------------------------------
56 // unlock document (optional: with locker string)
57 //-----------------------------------------------
58 } else if ( strcmp(argv[i],"-u") == 0 ) {
59 unlock_flag = 1;
60 if ( ++i < argc ) {
61 if ( *argv[i] != '-' ) {
62 strcpy(locker,argv[i++]);
63 }
64 }
65 } else {
66 printf("wrong program parameter\n");
67 break;
68 }
69 }
70 //--------------------------
71 // verify program parameters
72 //--------------------------
73 if ( (strlen(host) == 0) ||
74 (strlen(aid) == 0) ||
75 (strlen(docid) == 0) ||
76 ((lock_flag + unlock_flag) != 1) ) {
77 printf("\n");
78 printf("usage: %s -h <host> -a <aid> -d <docid>\n",argv[0]);
79 printf(" ( -l [<locker>] | -u [<locker>] )\n");
80 printf("\n");
81 printf("options:\n");
82 printf(" -h <host> hostname <host> of archive server.\n");
83 printf(" -a <aid> archive.\n");
84 printf(" -d <docid> document id.\n");
85 printf(" -l [<locker>] lock (optional: locker string)\n");
86 printf(" -u [<locker>] unlock (optional: locker string)\n");
87 printf("\n");
88 printf("description: lock or unlock document. If <locker> string\n");
89 printf(" is left empty, then everyone will be able\n");
90 printf(" to unlock the document!\n");
91 printf("\n");
92 return 1;
93 }
94
95 //----------------------
96 // initialize Server API
97 //----------------------
98 void *dsh = dshOpen(host,NULL,4060,8080,"http","user",*argv);
99 if ( dsh == NULL ) {
100 //-----------------------------
101 // archive server not reachable
102 //-----------------------------
103 printf("error: archive server '%s' not reachable\n",host);
104 return 1;
105 }
106
107 //--------------
108 // lock document
109 //--------------
110 if ( lock_flag == 1 ) {
111 if ( (ret=dshDsLock(dsh,aid,docid,locker)) == 0 ) {
112 //--------------------
113 // print error message
114 //--------------------
115 printf("error: %s\n",dshGetLastError(dsh));
116 return 1;
117 }
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 219
AR100500-PSA-EN-3
Chapter 4 Archive Server API in practice
118 //-------------------------
119 // document already locked?
120 //-------------------------
121 if ( ret == 2 ) {
122 printf("warning: document is already locked\n");
123 } else {
124 printf("success: document is locked\n");
125 }
126
127 //----------------
128 // unlock document
129 //----------------
130 } else {
131 if ( (ret=dshDsUnlock(dsh,aid,docid,locker,"no")) == 0 ) {
132 //--------------------
133 // print error message
134 //--------------------
135 printf("error: %s\n",dshGetLastError(dsh));
136 return 1;
137 }
138 switch ( ret ) {
139 case 1:
140 printf("success: document is unlocked\n");
141 break;
142 case 2:
143 printf("warning: document is not locked by locker\n");
144 break;
145 case 3:
146 printf("warning: document is not locked\n");
147 break;
148 default:
149 printf("error: %s\n",dshGetLastError(dsh));
150 return 1;
151 }
152 }
153
154 //----------------
155 // free Server API
156 //----------------
157 dshClose(dsh);
158 dshExit();
159
160 return 0;
161 }
162
163
1. Create program:
CC ‑o dsh_lock dsh_lock.cxx libdsh_3.so
2. Append the directory, where you have placed the shared libraries, to the
LD_LIBRARY_PATH variable (see also “Library files” on page 195).
% set LD_LIBRARY_PATH[9]="$LD_LIBRARY_PATH;<path to shared libs>"
% export LD_LIBRARY_PATH
3. Lock the document <docid> that you sent to the archive in the dsh_put
example page 201. Do not specify a locker string:
% dsh_lock ‑h host1 ‑a A1 ‑d <docid> ‑l
success: document is locked
%
4. Try to lock this document again. This should lead to a warning now,
because the document is already locked:
[9] Variable name for other platforms see “Library files” on page 195.
220 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
4.3. Sample programs in detail
6. Try to unlock the document a second time. Again this should result in a
warning:
% dsh_lock ‑h host1 ‑a A1 ‑d <docid> ‑u
warning: document is not locked
%
7. Now lock the document and specify a locker string this time:
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 221
AR100500-PSA-EN-3
Chapter 4 Archive Server API in practice
Note: Please note that this sample is designed for connections to Archive
Server version 9.7 or higher, whereas the preceding samples also can be
used with a lower software version.
Usage
usage: dsh_lock ‑h <host>
Options:
222 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
4.3. Sample programs in detail
41 break;
42 }
43 }
44 //--------------------------
45 // verify program parameters
46 //--------------------------
47 if ( (strlen(host) == 0) || (strlen(port) == 0) || (strlen(path) == 0) ) {
48 printf("\n");
49 printf("usage: %s -h <host> [-p <port>] [-s <path>]\n",argv[0]);
50 printf("\n");
51 printf("options:\n");
52 printf(" -h <host> hostname of archive server.\n");
53 printf(" -p <port> HTTP-port number (default=8080).\n");
54 printf(" -s <path> URL-path (default=/archive\n");
55 printf("\n");
56 printf("description: get information from Archive-Server about\n");
57 printf(" logical archives etc.\n");
58 printf("\n");
59 return 1;
60 }
61
62 //----------------------
63 // initialize Server API
64 //----------------------
65 void *dsh = dshOpen2(host,"http",atoi(port),path,"user","application");
66 if ( dsh == NULL ) {
67 //-----------------------------
68 // archive server not reachable
69 //-----------------------------
70 printf("error: archive server '%s' not reachable\n",host);
71 return 1;
72 }
73
74 //--------------------------------
75 // get info about logical archives
76 //--------------------------------
77 info = dshDsAdmInfo2(dsh,0,1);
78 if ( info == NULL ) {
79 printf("error: can't get info about logical archives: %s\n",
80 dshGetLastError(dsh));
81 return 1;
82 } else {
83 printf("\n");
84 printf("logical archive info:\n");
85 printf("-------------------- \n");
86 printf("\n%s\n\n",info);
87 }
88 dshFree(info);
89
90 //----------------
91 // free Server API
92 //----------------
93 dshClose(dsh);
94 dshExit();
95
96 return 0;
97 }
98
99
1. Create program:
g++ -o dsh_info dsh_info.cxx libdsh_3.so
>export LD_LIBRARY_PATH=`pwd`
>dsh_info -h vm91-sblqa
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 223
AR100500-PSA-EN-3
Chapter 4 Archive Server API in practice
archive server vers. type mode ssl-mode port_adms port_ds protocol security
connected http_port https_port url_path group storage_tiers
-----------------------------------------------------------------------------------------
----------------------------------------------------------------
AS samson 9.6 O ---- ssl_allow 4060 8080 http SEC_R3L2
yes 8080 8090 /archive samson
ASIG samson 9.6 O rcud ssl_allow 4060 8080 http SEC_R3L2
yes 8080 8090 /archive samson
CG samson 9.6 O rcud ssl_on 4061 8090 https SEC_R3L2
yes 8080 8090 /archive samson
...
OEWT vm91-sblqa 9.7 O ---- ssl_allow 4060 8080 http SEC_R3L2
yes 8080 8090 /archive vm91-sblqa
WX samson 9.6 O ---- ssl_on 4061 8090 https SEC_R3L2
yes 8080 8090 /archive samson
tts vm91-sblqa 9.7 O -cu- ssl_on 4061 8090 https SEC_R3L2
yes 8080 8090 /archive vm91-sblqa
224 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
Chapter 5
References
5.2 Events
This section gives a reference of all events that are tracked in the history of a
document, if the auditing feature is activated for an archive.[1] This feature is
available since software version 9.6.
Note: <volid1> and <volid2> are further parameters in the event list returned
by the dshDsGetDocumentHistory call.
EVENT_COMP_MOVED (value: 7)
Component has been moved moved from HDSK <volid1> to <volid2>.
[1] Compliance mode – see Section 38.1 “Auditing” in OpenText Archive Server - Administration Guide (AR-
ACN) for details.
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 225
AR100500-PSA-EN-3
Chapter 5 References
EVENT_COMP_PURGED (value: 9)
After transfering a component from the hard disk buffer to its target location,
the component in the buffer has been deleted (purged).
EVENT_CREATE_COMP (value: 2)
Component has been created on <volid1>.
EVENT_CREATE_DOC (value: 1)
Document has been created.
EVENT_TIMESTAMPED (value: 4)
Timestamp has been created on <volid1>.
EVENT_TIMESTAMP_VERIFIED (value: 5)
The timestamp has been verified on <volid1>.
EVENT_TIMESTAMP_VERIF_FAILED (value: 6)
The timestamp verification on <volid1> failed.
EVENT_UPDATE_ATTR (value: 3)
Attributes have been updated.
EVENT_CREATE_COMP (value: 2)
Component has been created on <volid1>.
EVENT_UPDATE_ATTR (value: 3)
Attributes have been updated.
EVENT_TIMESTAMPED (value: 4)
Timestamp has been created on <volid1>.
EVENT_TIMESTAMP_VERIFIED (value: 5)
The timestamp has been verified on <volid1>.
EVENT_TIMESTAMP_VERIF_FAILED (value: 6)
The timestamp verification on <volid1> failed.
226 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
5.2. Events
EVENT_COMP_MOVED (value: 7)
Component has been moved from HDSK <volid1> to <volid2>.
EVENT_COMP_COPIED (value: 8)
Component has been copied copied from <volid1> to <volid2>.
EVENT_COMP_PURGED (value: 9)
After transfering a component from the hard disk buffer to its target location,
the component in the buffer has been deleted (purged).
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 227
AR100500-PSA-EN-3
Chapter 5 References
Note: The environment variables are not modified by libdsh, if you change the
respective parameters within libdsh (via a dshSet* function, except
dshSetConfig). If you want to keep these modifications beyond the end of a
session, you must provide a corresponding storage procedure (see also
“Initializing and ending a libdsh session” on page 32).
DSH_ADMS_REFRESH_INTERVAL
Description: Refresh interval in seconds used to update server information, in
particular the hostname cache.
Admissible values: Integer value, max. 86400 (1 day)
Internal default: 3600
DSH_APPLICATION
Description: Name of the application using libdsh. This name is needed for
accounting purposes (see Section 2.3.3.3: “Setting parameters” on page 34).
Admissible values: String
Internal default: libdsh
DSH_AUTH_ID
Description: Unique client identifier (authenticity). See also “dshSetAuthId:
Set authenticity” on page 178 and “Access protection via SecKeys (signed
URLs)” on page 22.
Admissible values: String
Internal default: The host name
DSH_CHECKSUM
Description: If set to on, files sent to the archive get an additional checksum
which is checked by the Archive Server to avoid transmission errors. If the
server detects an error, the libdsh function fails and returns an error condition
DSH_ERR_CREATE_CHECKSUM). If DSH_CHECKSUM is set to off, this check is not
provided, resulting in faster transmission but a greater risk of errors. This setting
does not require a corresponding setting on the server.
Admissible values: on, off
Internal default: on
DSH_DS_REFRESH_INTERVAL
Description: Refresh interval for the hostname cache (in seconds).
228 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
5.3. Global environment variables
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 229
AR100500-PSA-EN-3
Chapter 5 References
DSH_PROXY
Description: URL of proxy server. See also “Proxy server” on page 13 and
“dshSetProxy: Set proxy server” on page 190.
Admissible values: String with format http://<host>:<port>
Internal default: undef
DSH_READ_BUFFER_SIZE
Description: Size of the read buffer
Admissible values: Integer value
Internal default: 65536
DSH_READ_TIMEOUT
Description: Timout period for reading a document from the archive (in
seconds)
Admissible values: Integer value
Internal default: 120
Note: For the retrieval of large documents with a timestamp, this value
possibly must be increased, because the timestamp verification of large
documents can take some extra time on the server.
DSH_REQUEST_RETRY_INTERVAL_MS
Description: Time interval (in milliseconds) to wait before a request is tried
again. See also DSH_MAX_REQUEST_RETRY_TIME on page 229.
Admissible values: Integer value
Internal default: 120
DSH_SCRIPT
Description: Parameter in the default HTTP URL: http://<server>:<port>/
<script>. Usually required for debugging purposes only.
Internal default: archive
DSH_USER
Description: User name. This name is needed for accounting purposes (see
Section 2.3.3.3: “Setting parameters” on page 34).
Admissible values: String
Internal default: The host name
DSH_VERIFY_SIG_TIMEOUT
Description: Internal timeout in seconds for a dshDsVerifySig call.
Admissible values: Integer value
Internal default: 5
230 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
5.3. Global environment variables
LOG_DEBUG
Description: If set to on, libdsh prints debug logging information to the stderr
stream or the log file, if set via the dshSetLogFile function. See “Logging”
on page 32 and “dshSetLogLevel: Set log level” on page 184.
Admissible values: on, off
Internal default: off
LOG_DSH[2]
Description: Activates/deactivates the tracing of the internal library, which is
used by libdsh for the HTTP communication. Depending on the version of the
used DLLs (see “Library files” on page 195), the meaning and the admissible
values of this variable are different:
• Version 5.5.2003.409 (build SV55–026) and later:
The variable just activates or deactivates the tracing, so admissible values are
on or off.
Admissible values:
Internal default: off
• Before Version 5.5.2003.409 (build SV55–026):
The value of LOG_DSH is a string of characters, each of which sets up one of
the following TRACE flags:
• a: show ANCHOR trace messages
• b: show BIND trace messages
• c: show CACHE trace messages
• f: show BASIC UTILITIES trace messages
• g: show SGML trace messages
• h: show AUTH trace messages
• i: show PICS trace messages
• l: show APPLICATION LEVEL trace msg.
• m: show MEMORY trace messages
• o: show CORE trace messages
• p: show PROTOCOL trace messages
• q: show SQL trace messages
• s: show STREAM trace messages
• t: show THREAD trace messages
• u: show URI trace messages
[2] It is possible that this variable may not be supported by your libdsh version (open item until the deadline
of this manual)
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 231
AR100500-PSA-EN-3
Chapter 5 References
LOG_ENTRY
Description: If set to on, libdsh prints log messages regarding function entry
points to the stderr stream or the log file, if set via the dshSetLogFile
function. See also “Logging” on page 32 and “dshSetLogLevel: Set log level”
on page 184.
Admissible values: on, off
Internal default: off
LOG_ERROR
Description: If set to on, libdsh prints error messages to the stderr stream or the
log file, if set via the dshSetLogFile function – see also “Logging” on page 32
and “dshSetLogLevel: Set log level” on page 184. Note that this option can
only be set via this variable, not via the dshSetLogLevel function.
Admissible values: on, off
Internal default: off
LOG_FATAL
Description: If set to on, libdsh prints fatal error messages to the stderr stream
or the log file, if set via the dshSetLogFile function – see also “Logging”
on page 32 and “dshSetLogLevel: Set log level” on page 184. Note that this
option can only be set via this variable, not via the dshSetLogLevel function.
Admissible values: on, off
Internal default: on
LOG_IMPORTANT
Description: If set to on, libdsh prints information messages to the stderr
stream or the log file, if set via the dshSetLogFile function. See also “Logging”
on page 32 and “dshSetLogLevel: Set log level” on page 184.
Admissible values: on, off
Internal default: off
LOG_INFO
Description: If set to on, libdsh prints information messages to the stderr
stream or the log file, if set via the dshSetLogFile function. See also “Logging”
on page 32 and “dshSetLogLevel: Set log level” on page 184.
Admissible values: on, off
Internal default: off
LOG_REL
Description: If set to on, libdsh provided a more detailed time stamp in the log
file by adding a μs specification. This may be usefule, if timing problems occur.
232 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
5.3. Global environment variables
LOG_WARNING
Description: If set to on, libdsh prints warning messages to the stderr stream or
the log file, if set via the dshSetLogFile function – see also “Logging”
on page 32 and “dshSetLogLevel: Set log level” on page 184. Note that this
option can only be set via this variable, not via the dshSetLogLevel function.
Admissible values: on, off
Internal default: off
MAXLOGSIZE
Description: This variable specifies the maximum size of the log file in Byte as
described in “dshSetLogMaxSize: Set maximum size of log file” on page 186.
Admissible values: Integer value
Internal default: 100000
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 233
AR100500-PSA-EN-3
Chapter 5 References
DSH_ERR_ADD_MIME_PARSER
Can't add MIME parser to HTTP library (error no.: 11000)
Internal error, please inform IXOS if this error should occur.
DSH_ERR_CREATE_CHECKSUM
Error in creating checksum (error no.: 11205) – see DSH_CHECKSUM on page 228.
DSH_ERR_FUNCTION_ARGUMENT
Wrong function argument (for example, NULL pointer) (error no.: 11203)
DSH_ERR_HTTP_400
HTTP error (bad request [400]): Unknown function or parameter (error no.:
11005)
DSH_ERR_HTTP_401
HTTP error (unauthorized [401]): Breach of security (error no.: 11006). You tried
to access a document that is protected via SecKeys, and your application is not
able to generate the required SecKey – see also “Access protection via SecKeys
(signed URLs)” on page 22.
DSH_ERR_HTTP_403
HTTP error (forbidden [403]): Document/component already exists (error no.:
11007)
DSH_ERR_HTTP_404
HTTP error (not found [404]): Document/component/archive not found (error
no.: 11008)
DSH_ERR_HTTP_404_DELA
HTTP error (not found [404]): Either the document, the component or the
attribute does not exist (error no.: 11016, caused by dshDsDelAttribute)
DSH_ERR_HTTP_404_GETA
HTTP error (not found [404]): Either the document, the component or the
attribute does not exist (error no.: 11015, caused by dshDsGetAttribute)
234 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
5.4. libdsh errors
DSH_ERR_HTTP_404_SETA
May occur in: dshDsSetAttribute
DSH_ERR_HTTP_404_VU
HTTP error (not found [404]): A user account with the specified user/passwd
combination does not exist. The user is not found (error no.: 11014)
DSH_ERR_HTTP_406
HTTP error (not acceptable [406]): Certificate cannot be recognized (error no.:
11009)
DSH_ERR_HTTP_409
HTTP error (conflict [409]): Document/component/administrat. data is
inaccessible (error no.: 11010)
DSH_ERR_HTTP_409_INFO
HTTP error (conflict [409]): Administrative data is inaccessible (error no.: 11020)
DSH_ERR_HTTP_409_LOCK
HTTP error (conflict [409]): There was already a lock on the document (error no.:
11018)
DSH_ERR_HTTP_409_UNLOCK
HTTP error (conflict [409]): The document was not locked by locker. Therefore
the lock could not be removed (error no.: 11019)
DSH_ERR_HTTP_412
HTTP error (precondition failed [412]) (error no.: 11011)
DSH_ERR_HTTP_412_UNLOCK
HTTP error (precondition failed [412]): The document was not locked (error no.:
11021)
DSH_ERR_HTTP_500
HTTP error (Internal Server Error [500]): Internal error in archive server (error
no.: 11012)
DSH_ERR_HTTP_CONNECTION_BROKEN
HTTP error: connection was broken (error no.: 11003)
DSH_ERR_HTTP_EMPTY_RESULT
Wrong (empty) result from archive server (error no.: 11002). libdsh expected the
repository server to return a non-empty piece of data (for example, a
component), but it returned an empty piece of data (for example, a component
with a size 0). This is not necessarily an error, in particular if testing is being
performed.
DSH_ERR_HTTP_PARSE_HEADER
Error in parsing HTTP header (error no.: 11001)
This error occurs, if the HTTP header does not correspond to the structure
expected by the libdsh function (for example, dshDsInfo). Probably this is
caused by a transmission error or is an internal error, please inform IXOS in this
case.
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 235
AR100500-PSA-EN-3
Chapter 5 References
DSH_ERR_HTTP_UNKNOWN
HTTP error: unknown error (error no.: 11004)
DSH_ERR_OUT_OF_MEMORY
Out of memory (error no.: 11204)
DSH_ERR_R3_INFO
No SAP information available (error no.: 11200)
DSH_ERR_UNKNOWN_ARCHIVE
Unknown archive (error no.: 11206). This error occurs if you try to access an
archive that is not listed in the hostname cache. The archive name may have
been misspelled, or the hostname cache may not be up-to-date (call
dshSetAidRefreshTime(<dsh handle>, 0) in this case to update the table).
DSH_ERR_UNKNOWN_COMP
Unknown component (error no.: 11209)
11000: DSH_ERR_ADD_MIME_PARSER
11001: DSH_ERR_HTTP_PARSE_HEADER
11002: DSH_ERR_HTTP_EMPTY_RESULT
11003: DSH_ERR_HTTP_CONNECTION_BROKEN
11004: DSH_ERR_HTTP_UNKNOWN
11005: DSH_ERR_HTTP_400
11006: DSH_ERR_HTTP_401
11007: DSH_ERR_HTTP_403
11008: DSH_ERR_HTTP_404
11009: DSH_ERR_HTTP_406
11010: DSH_ERR_HTTP_409
11011: DSH_ERR_HTTP_412
11012: DSH_ERR_HTTP_500
11014: DSH_ERR_HTTP_404_VU
11015: DSH_ERR_HTTP_404_GETA
11016: DSH_ERR_HTTP_404_DELA
11017: DSH_ERR_HTTP_404_SETA
11018: DSH_ERR_HTTP_409_LOCK
11019: DSH_ERR_HTTP_409_UNLOCK
11020: DSH_ERR_HTTP_409_INFO
11021: DSH_ERR_HTTP_412_UNLOCK
11203: DSH_ERR_FUNCTION_ARGUMENT
11204: DSH_ERR_OUT_OF_MEMORY
236 OpenText Archive Server – Programming Guide for the OpenText Archive Server API
AR100500-PSA-EN-3
5.5. Figures and tables
11205: DSH_ERR_CREATE_CHECKSUM
11206: DSH_ERR_UNKNOWN_ARCHIVE
11207: DSH_ERR_ACCESS_FILE
11209: DSH_ERR_UNKNOWN_COMP
Figure 3-1: “Each DAIN line represents a complete attribute set; within this set, each
attribute can be uniquely addressed by its local offset and its string length.”
on page 59
List of Tables
OpenText Archive Server – Programming Guide for the OpenText Archive Server API 237
AR100500-PSA-EN-3