Avoid redundant YAZ includes.
[yaz4j-moved-to-github.git] / dependencies / yaz-2.1.28 / doc / asn.oid.html
1 <html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>3. Object Identifiers</title><meta name="generator" content="DocBook XSL Stylesheets V1.70.1"><link rel="start" href="index.html" title="YAZ User's Guide and Reference"><link rel="up" href="asn.html" title="Chapter 6. The Z39.50 ASN.1 Module"><link rel="prev" href="asn.preparing.html" title="2. Preparing PDUs"><link rel="next" href="asn.external.html" title="4. EXTERNAL Data"></head><body><link rel="stylesheet" type="text/css" href="common/style1.css"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">3. Object Identifiers</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="asn.preparing.html">Prev</a> </td><th width="60%" align="center">Chapter 6. The Z39.50 ASN.1 Module</th><td width="20%" align="right"> <a accesskey="n" href="asn.external.html">Next</a></td></tr></table><hr></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="asn.oid"></a>3. Object Identifiers</h2></div></div></div><p>
2     When you refer to object identifiers in your application, you need to
3     be aware that SR and Z39.50 use two different set of OIDs to refer to
4     the same objects. To handle this easily, YAZ provides a utility module
5     to Z39.50 ASN.1 which provides an internal representation of the OIDs used in
6     both protocols. Each oid is described by a structure:
7    </p><pre class="screen">
8 typedef struct oident
9 {
10     enum oid_proto proto;
11     enum oid_class class;
12     enum oid_value value;
13     int oidsuffix[OID_SIZE];
14     char *desc;
15 } oident;
16    </pre><p>
17     The <code class="literal">proto</code> field can be set to either
18     <code class="literal">PROTO_SR</code> or <code class="literal">PROTO_Z3950</code>.
19     The <code class="literal">class</code> might be, say,
20     <code class="literal">CLASS_RECSYN</code>, and the <code class="literal">value</code> might be
21     <code class="literal">VAL_USMARC</code> for the USMARC record format. Functions
22    </p><pre class="screen">
23 int *oid_ent_to_oid(struct oident *ent, int *dst);
24 struct oident *oid_getentbyoid(int *o);
25    </pre><p>
26     are provided to map between object identifiers and database entries.
27     If you store a member of the <code class="literal">oid_proto</code> type in
28     your association state information, it's a simple matter, at runtime,
29     to generate the correct OID when you need it. For decoding, you can
30     simply ignore the proto field, or if you're strict, you can verify
31     that your peer is using the OID family from the correct protocol.
32     The <code class="literal">desc</code> field is a short, human-readable name
33     for the PDU, useful mainly for diagnostic output.
34    </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
35      The old function <code class="function">oid_getoidbyent</code> still exists but
36      is not thread safe. Use <code class="function">oid_ent_to_oid</code> instead
37      and pass an array of size <code class="literal">OID_SIZE</code>.
38     </p></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
39      Plans are underway to merge the two protocols into a single
40      definition, with one set of object identifiers. When this happens, the
41      oid module will no longer be required to support protocol
42      independence, but it should still be useful as a simple OID database.
43     </p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="asn.preparing.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="asn.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="asn.external.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">2. Preparing PDUs </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 4. EXTERNAL Data</td></tr></table></div></body></html>