]>
git.saurik.com Git - apple/security.git/blob - libsecurity_smime/lib/SecAsn1Item.h
2 * The contents of this file are subject to the Mozilla Public
3 * License Version 1.1 (the "License"); you may not use this file
4 * except in compliance with the License. You may obtain a copy of
5 * the License at http://www.mozilla.org/MPL/
7 * Software distributed under the License is distributed on an "AS
8 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
9 * implied. See the License for the specific language governing
10 * rights and limitations under the License.
12 * The Original Code is the Netscape security libraries.
14 * The Initial Developer of the Original Code is Netscape
15 * Communications Corporation. Portions created by Netscape are
16 * Copyright (C) 1994-2000 Netscape Communications Corporation. All
21 * Alternatively, the contents of this file may be used under the
22 * terms of the GNU General Public License Version 2 or later (the
23 * "GPL"), in which case the provisions of the GPL are applicable
24 * instead of those above. If you wish to allow use of your
25 * version of this file only under the terms of the GPL and not to
26 * allow others to use your version of this file under the MPL,
27 * indicate your decision by deleting the provisions above and
28 * replace them with the notice and other provisions required by
29 * the GPL. If you do not delete the provisions above, a recipient
30 * may use your version of this file under either the MPL or the
37 * SecAsn1Item.h - public data structures and prototypes for handling
41 #include <security_asn1/seccomon.h>
42 #include <security_asn1/plarenas.h>
48 ** Allocate an item. If "arena" is not NULL, then allocate from there,
49 ** otherwise allocate from the heap. If "item" is not NULL, allocate
50 ** only the data for the item, not the item itself. The item structure
51 ** is allocated zero-filled; the data buffer is not zeroed.
53 ** The resulting item is returned; NULL if any error occurs.
55 ** XXX This probably should take a SecAsn1ItemType, but since that is mostly
56 ** unused and our improved APIs (aka Stan) are looming, I left it out.
58 extern SecAsn1Item
*SECITEM_AllocItem(PRArenaPool
*arena
, SecAsn1Item
*item
,
62 ** Reallocate the data for the specified "item". If "arena" is not NULL,
63 ** then reallocate from there, otherwise reallocate from the heap.
64 ** In the case where oldlen is 0, the data is allocated (not reallocated).
65 ** In any case, "item" is expected to be a valid SecAsn1Item pointer;
66 ** SECFailure is returned if it is not. If the allocation succeeds,
67 ** SECSuccess is returned.
69 extern SECStatus
SECITEM_ReallocItem(PRArenaPool
*arena
, SecAsn1Item
*item
,
70 size_t oldlen
, size_t newlen
);
73 ** Compare two items returning the difference between them.
75 extern SECComparison
SECITEM_CompareItem(const SecAsn1Item
*a
, const SecAsn1Item
*b
);
78 ** Compare two items -- if they are the same, return true; otherwise false.
80 extern Boolean
SECITEM_ItemsAreEqual(const SecAsn1Item
*a
, const SecAsn1Item
*b
);
83 ** Copy "from" to "to"
85 extern SECStatus
SECITEM_CopyItem(PRArenaPool
*arena
, SecAsn1Item
*to
,
86 const SecAsn1Item
*from
);
89 ** Allocate an item and copy "from" into it.
91 extern SecAsn1Item
*SECITEM_DupItem(const SecAsn1Item
*from
);
94 ** Allocate an item and copy "from" into it. The item itself and the
95 ** data it points to are both allocated from the arena. If arena is
96 ** NULL, this function is equivalent to SECITEM_DupItem.
98 extern SecAsn1Item
*SECITEM_ArenaDupItem(PRArenaPool
*arena
, const SecAsn1Item
*from
);
101 ** Free "zap". If freeit is PR_TRUE then "zap" itself is freed.
103 extern void SECITEM_FreeItem(SecAsn1Item
*zap
, Boolean freeit
);
106 ** Zero and then free "zap". If freeit is PR_TRUE then "zap" itself is freed.
108 extern void SECITEM_ZfreeItem(SecAsn1Item
*zap
, Boolean freeit
);
110 PLHashNumber PR_CALLBACK
SECITEM_Hash ( const void *key
);
112 PRIntn PR_CALLBACK
SECITEM_HashCompare ( const void *k1
, const void *k2
);
117 #endif /* _SECITEM_H_ */