]>
git.saurik.com Git - apple/security.git/blob - SecuritySNACCRuntime/c++-lib/inc/asn-any.h
1d55e40aa071e3e44677b5b44cb9a96117e8ba6e
2 * Copyright (c) 2000-2001 Apple Computer, Inc. All Rights Reserved.
4 * The contents of this file constitute Original Code as defined in and are
5 * subject to the Apple Public Source License Version 1.2 (the 'License').
6 * You may not use this file except in compliance with the License. Please obtain
7 * a copy of the License at http://www.apple.com/publicsource and read it before
10 * This Original Code and all software distributed under the License are
11 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS
12 * OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT
13 * LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
14 * PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please see the License for the
15 * specific language governing rights and limitations under the License.
19 // file: .../c++-lib/inc/asn-any.h - C++ class for any type
22 // Copyright (C) 1992 Michael Sample and the University of British Columbia
24 // This library is free software; you can redistribute it and/or
25 // modify it provided that this copyright/license information is retained
28 // If you modify this file, you must clearly indicate your changes.
30 // This source code is distributed in the hope that it will be
31 // useful, but WITHOUT ANY WARRANTY; without even the implied warranty
32 // of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
35 // ------------------------------------------------------------------------
36 // - J.G. Van Dyke & Associates, Inc. Modification History of SNACC 1.3 -
37 // ------------------------------------------------------------------------
39 // All modification are relative to the v1.3 of SNACC. We used SunOS 4.1.3's
40 // SCCS. The revision #'s start at 1.1, which is the original version from
44 // ../SCCS/s.asn-any.h:
46 // D 1.2 98/05/01 13:46:36 pleonber 2 1 00008/00000/00099
47 // added destructor and copy for CSM_Buffer handling (cleans up memory).
49 // D 1.1 98/05/01 13:16:05 pleonber 1 0 00099/00000/00000
50 // date and time created 98/05/01 13:16:05 by pleonber
52 // ----------------------- End of VDA Modifications ---------------------------
56 // $Header: /cvs/root/Security/SecuritySNACCRuntime/c++-lib/inc/Attic/asn-any.h,v 1.1.1.1 2001/05/18 23:14:06 mb Exp $
57 // $Log: asn-any.h,v $
58 // Revision 1.1.1.1 2001/05/18 23:14:06 mb
59 // Move from private repository to open source repository
61 // Revision 1.5 2001/05/05 00:59:17 rmurphy
62 // Adding darwin license headers
64 // Revision 1.4 2000/12/22 20:33:26 mb
65 // New Security framework fase 1 complete.
67 // Revision 1.3 2000/12/07 22:14:38 dmitch
68 // Thread-safe mods: made oidHashTbl and intHashTbl private.
70 // Revision 1.2 2000/06/15 18:48:25 dmitch
71 // Snacc-generated source files, now part of CVS tree to allow for cross-platform build of snaccRuntime.
73 // Revision 1.1.1.1 2000/03/09 01:00:05 rmurphy
74 // Base Fortissimo Tree
76 // Revision 1.4 1999/03/21 02:07:31 mb
77 // Added Copy to every AsnType.
79 // Revision 1.3 1999/03/18 22:35:26 mb
80 // Made all destructors virtual.
82 // Revision 1.2 1999/02/26 00:32:55 mb
83 // Fix bug when not building with VDADER_RULES defined.
85 // Revision 1.1 1999/02/25 05:21:40 mb
86 // Added snacc c++ library
88 // Revision 1.4 1997/01/02 08:39:42 rj
89 // missing prototype added
91 // Revision 1.3 1994/10/08 04:17:56 rj
92 // code for meta structures added (provides information about the generated code itself).
94 // code for Tcl interface added (makes use of the above mentioned meta code).
96 // virtual inline functions (the destructor, the Clone() function, BEnc(), BDec() and Print()) moved from inc/*.h to src/*.C because g++ turns every one of them into a static non-inline function in every file where the .h file gets included.
98 // made Print() const (and some other, mainly comparison functions).
100 // several `unsigned long int' turned into `size_t'.
102 // Revision 1.2 1994/08/28 10:00:43 rj
103 // comment leader fixed.
105 // Revision 1.1 1994/08/28 09:20:24 rj
106 // first check-in. for a list of changes to the snacc-1.1 distribution please refer to the ChangeLog.
112 #include "shmmgr.h" // Guido Grassel 4.8.93
113 #endif /* _IBM_ENC_ */
118 #include <Security/threading.h> /* for Mutex */
121 /* this is put into the hash table with the int or oid as the key */
125 class AnyInfo
: public MemMgr
// Guido Grassel 4.8.93
126 #endif /* _IBM_ENC_ */
129 int anyId
; // will be a value from the AnyId enum
130 AsnOid oid
; // will be zero len/null if intId is valid
132 AsnType
* typeToClone
;
135 #if defined(macintosh) || defined(__APPLE__)
139 class AsnAny
: public AsnType
142 /* need a lock to protect these, declared as a static in the .cpp file.
143 *...plus, I have no idea why these
144 * were declared public. They are not used anywhere else.
147 static Table
* oidHashTbl
; // all AsnAny class instances
148 static Table
* intHashTbl
; // share these tables
152 static Table
* oidHashTbl
; // all AsnAny class instances
153 static Table
* intHashTbl
; // share these tables
155 AnyInfo
* ai
; // points to entry in hash tbl for this type
156 #if defined(macintosh) || defined(__APPLE__)
157 // FIXME - needs work
162 AsnAny () { ai
= NULL
; value
= NULL
; }
164 // class level methods
165 static void InstallAnyByInt ( AsnInt intId
, int anyId
, AsnType
* type
);
166 static void InstallAnyByOid ( AsnOid
& oid
, int anyId
, AsnType
* type
);
168 int GetId () const { return ai
? ai
-> anyId
: - 1 ; }
169 void SetTypeByInt ( AsnInt id
);
170 void SetTypeByOid ( AsnOid
& id
);
172 virtual AsnType
* Clone () const ;
173 virtual AsnType
* Copy () const ;
175 AsnLen
BEnc ( BUF_TYPE b
);
176 void BDec ( BUF_TYPE b
, AsnLen
& bytesDecoded
, ENV_TYPE env
);
180 void Print ( ostream
&) const ;
184 int TclGetDesc ( Tcl_DString
*) const ;
185 int TclGetVal ( Tcl_DString
*) const ;
186 int TclSetVal ( Tcl_Interp
*, const char * val
);
187 int TclUnSetVal ( Tcl_Interp
*, const char * member
);
193 AsnAny
& operator = ( const AsnAny
& o
);
196 // AnyDefinedBy is currently the same as AsnAny:
197 typedef AsnAny AsnAnyDefinedBy
;
201 #endif /* _conditional_include_ */
203 #endif /* _asn_any_h_ */