~ubuntu-branches/ubuntu/wily/afnix/wily

« back to all changes in this revision

Viewing changes to src/mod/itu/shl/AsnNode.cpp

  • Committer: Package Import Robot
  • Author(s): Nobuhiro Iwamatsu
  • Date: 2015-07-11 02:00:35 UTC
  • mfrom: (10.1.1 sid)
  • Revision ID: package-import@ubuntu.com-20150711020035-2nhpztq7s15qyc0v
Tags: 2.5.1-1
* New upstream release. (Closes: #789968)
* Update debian/control.
  - Update Standards-Version to 3.9.6.
* Add support mips64(el) and ppc64el. (Closes: #741508, #748146)
* Add patches/support-gcc-5.x.patch. (Closes: #777767)
  - Fix build with gcc-5.x.
* Add patches/Disable-NET0001.als.patch.
  - Disable test of NET0001.als.

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
// - the copyright holder be liable for any  direct, indirect, incidental or -
12
12
// - special damages arising in any way out of the use of this software.     -
13
13
// ---------------------------------------------------------------------------
14
 
// - copyright (c) 1999-2012 amaury darsch                                   -
 
14
// - copyright (c) 1999-2015 amaury darsch                                   -
15
15
// ---------------------------------------------------------------------------
16
16
 
17
 
#include "Item.hpp"
18
17
#include "Vector.hpp"
19
18
#include "AsnNode.hpp"
20
19
#include "AsnNode.hxx"
137
136
  }
138
137
 
139
138
  // -------------------------------------------------------------------------
 
139
  // - public section                                                        -
 
140
  // -------------------------------------------------------------------------
 
141
 
 
142
  // the object eval quarks
 
143
  static const long QUARK_ASNBER  = String::intern ("BER");
 
144
  static const long QUARK_ASNDER  = String::intern ("DER");
 
145
  static const long QUARK_ASNCER  = String::intern ("CER");
 
146
  static const long QUARK_ASNUNIV = String::intern ("UNIVERSAL");
 
147
  static const long QUARK_ASNAPPL = String::intern ("APPLICATION");
 
148
  static const long QUARK_ASNCTXS = String::intern ("CONTEXT-SPECIFIC");
 
149
  static const long QUARK_ASNPRIV = String::intern ("PRIVATE");
 
150
  static const long QUARK_ASNNODE = String::intern ("AsnNode");
 
151
 
 
152
  // map an item to an encoding rule type
 
153
  
 
154
  AsnNode::t_encr AsnNode::toencr (const Item& item) {
 
155
    // check for an asn node item
 
156
    if (item.gettid () != QUARK_ASNNODE)
 
157
      throw Exception ("item-error", "item is not an asn node item");
 
158
    // map the item to the enumeration
 
159
    long quark = item.getquark ();
 
160
    if (quark == QUARK_ASNBER) return AsnNode::ASN_BER;
 
161
    if (quark == QUARK_ASNCER) return AsnNode::ASN_CER;
 
162
    if (quark == QUARK_ASNDER) return AsnNode::ASN_DER;
 
163
    throw Exception ("item-error", "cannot map item to asn encoding rule");
 
164
  }
 
165
 
 
166
  // map an item to a node class type
 
167
  
 
168
  AsnNode::t_ncls AsnNode::toncls (const Item& item) {
 
169
    // check for an asn node item
 
170
    if (item.gettid () != QUARK_ASNNODE)
 
171
      throw Exception ("item-error", "item is not an asn node item");
 
172
    // map the item to the enumeration
 
173
    long quark = item.getquark ();
 
174
    if (quark == QUARK_ASNUNIV) return AsnNode::CLS_UNIV;
 
175
    if (quark == QUARK_ASNAPPL) return AsnNode::CLS_APPL;
 
176
    if (quark == QUARK_ASNCTXS) return AsnNode::CLS_CTXS;
 
177
    if (quark == QUARK_ASNPRIV) return AsnNode::CLS_PRIV;
 
178
    throw Exception ("item-error", "cannot map item to asn node class");
 
179
  }
 
180
 
 
181
  // -------------------------------------------------------------------------
140
182
  // - protected section                                                     -
141
183
  // -------------------------------------------------------------------------
142
184
 
495
537
  // - object section                                                        -
496
538
  // -------------------------------------------------------------------------
497
539
 
498
 
  // the object eval quarks
499
 
  static const long QUARK_ASNBER  = String::intern ("BER");
500
 
  static const long QUARK_ASNDER  = String::intern ("DER");
501
 
  static const long QUARK_ASNCER  = String::intern ("CER");
502
 
  static const long QUARK_ASNUNIV = String::intern ("UNIVERSAL");
503
 
  static const long QUARK_ASNAPPL = String::intern ("APPLICATION");
504
 
  static const long QUARK_ASNCTXS = String::intern ("CONTEXT-SPECIFIC");
505
 
  static const long QUARK_ASNPRIV = String::intern ("PRIVATE");
506
 
  static const long QUARK_ASNNODE = String::intern ("AsnNode");
507
 
 
508
540
  // the quark zone
509
541
  static const long QUARK_ZONE_LENGTH = 7;
510
542
  static QuarkZone  zone (QUARK_ZONE_LENGTH);