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
* secitem.h - public data structures and prototypes for handling
40
* $Id: secitem.h,v 1.3 2003/12/06 01:16:49 wchang0222%aol.com Exp $
50
** Allocate an item. If "arena" is not NULL, then allocate from there,
51
** otherwise allocate from the heap. If "item" is not NULL, allocate
52
** only the data for the item, not the item itself. The item structure
53
** is allocated zero-filled; the data buffer is not zeroed.
55
** The resulting item is returned; NULL if any error occurs.
57
** XXX This probably should take a SECItemType, but since that is mostly
58
** unused and our improved APIs (aka Stan) are looming, I left it out.
60
extern SECItem *SECITEM_AllocItem(PRArenaPool *arena, SECItem *item,
64
** Reallocate the data for the specified "item". If "arena" is not NULL,
65
** then reallocate from there, otherwise reallocate from the heap.
66
** In the case where oldlen is 0, the data is allocated (not reallocated).
67
** In any case, "item" is expected to be a valid SECItem pointer;
68
** SECFailure is returned if it is not. If the allocation succeeds,
69
** SECSuccess is returned.
71
extern SECStatus SECITEM_ReallocItem(PRArenaPool *arena, SECItem *item,
72
unsigned int oldlen, unsigned int newlen);
75
** Compare two items returning the difference between them.
77
extern SECComparison SECITEM_CompareItem(const SECItem *a, const SECItem *b);
80
** Compare two items -- if they are the same, return true; otherwise false.
82
extern PRBool SECITEM_ItemsAreEqual(const SECItem *a, const SECItem *b);
85
** Copy "from" to "to"
87
extern SECStatus SECITEM_CopyItem(PRArenaPool *arena, SECItem *to,
91
** Allocate an item and copy "from" into it.
93
extern SECItem *SECITEM_DupItem(const SECItem *from);
96
** Allocate an item and copy "from" into it. The item itself and the
97
** data it points to are both allocated from the arena. If arena is
98
** NULL, this function is equivalent to SECITEM_DupItem.
100
extern SECItem *SECITEM_ArenaDupItem(PRArenaPool *arena, const SECItem *from);
103
** Free "zap". If freeit is PR_TRUE then "zap" itself is freed.
105
extern void SECITEM_FreeItem(SECItem *zap, PRBool freeit);
108
** Zero and then free "zap". If freeit is PR_TRUE then "zap" itself is freed.
110
extern void SECITEM_ZfreeItem(SECItem *zap, PRBool freeit);
112
PLHashNumber PR_CALLBACK SECITEM_Hash ( const void *key);
114
PRIntn PR_CALLBACK SECITEM_HashCompare ( const void *k1, const void *k2);
119
#endif /* _SECITEM_H_ */