~ubuntu-branches/ubuntu/precise/kompozer/precise

« back to all changes in this revision

Viewing changes to mozilla/security/nss/lib/util/secitem.h

  • Committer: Bazaar Package Importer
  • Author(s): Anthony Yarusso
  • Date: 2007-08-27 01:11:03 UTC
  • Revision ID: james.westby@ubuntu.com-20070827011103-2jgf4s6532gqu2ka
Tags: upstream-0.7.10
ImportĀ upstreamĀ versionĀ 0.7.10

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
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/
 
6
 * 
 
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.
 
11
 * 
 
12
 * The Original Code is the Netscape security libraries.
 
13
 * 
 
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
 
17
 * Rights Reserved.
 
18
 * 
 
19
 * Contributor(s):
 
20
 * 
 
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
 
31
 * GPL.
 
32
 */
 
33
 
 
34
#ifndef _SECITEM_H_
 
35
#define _SECITEM_H_
 
36
/*
 
37
 * secitem.h - public data structures and prototypes for handling
 
38
 *             SECItems
 
39
 *
 
40
 * $Id: secitem.h,v 1.3 2003/12/06 01:16:49 wchang0222%aol.com Exp $
 
41
 */
 
42
 
 
43
#include "plarena.h"
 
44
#include "plhash.h"
 
45
#include "seccomon.h"
 
46
 
 
47
SEC_BEGIN_PROTOS
 
48
 
 
49
/*
 
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.
 
54
**
 
55
** The resulting item is returned; NULL if any error occurs.
 
56
**
 
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.
 
59
*/
 
60
extern SECItem *SECITEM_AllocItem(PRArenaPool *arena, SECItem *item,
 
61
                                  unsigned int len);
 
62
 
 
63
/*
 
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.
 
70
*/
 
71
extern SECStatus SECITEM_ReallocItem(PRArenaPool *arena, SECItem *item,
 
72
                                     unsigned int oldlen, unsigned int newlen);
 
73
 
 
74
/*
 
75
** Compare two items returning the difference between them.
 
76
*/
 
77
extern SECComparison SECITEM_CompareItem(const SECItem *a, const SECItem *b);
 
78
 
 
79
/*
 
80
** Compare two items -- if they are the same, return true; otherwise false.
 
81
*/
 
82
extern PRBool SECITEM_ItemsAreEqual(const SECItem *a, const SECItem *b);
 
83
 
 
84
/*
 
85
** Copy "from" to "to"
 
86
*/
 
87
extern SECStatus SECITEM_CopyItem(PRArenaPool *arena, SECItem *to, 
 
88
                                  const SECItem *from);
 
89
 
 
90
/*
 
91
** Allocate an item and copy "from" into it.
 
92
*/
 
93
extern SECItem *SECITEM_DupItem(const SECItem *from);
 
94
 
 
95
/*
 
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.
 
99
*/
 
100
extern SECItem *SECITEM_ArenaDupItem(PRArenaPool *arena, const SECItem *from);
 
101
 
 
102
/*
 
103
** Free "zap". If freeit is PR_TRUE then "zap" itself is freed.
 
104
*/
 
105
extern void SECITEM_FreeItem(SECItem *zap, PRBool freeit);
 
106
 
 
107
/*
 
108
** Zero and then free "zap". If freeit is PR_TRUE then "zap" itself is freed.
 
109
*/
 
110
extern void SECITEM_ZfreeItem(SECItem *zap, PRBool freeit);
 
111
 
 
112
PLHashNumber PR_CALLBACK SECITEM_Hash ( const void *key);
 
113
 
 
114
PRIntn PR_CALLBACK SECITEM_HashCompare ( const void *k1, const void *k2);
 
115
 
 
116
 
 
117
SEC_END_PROTOS
 
118
 
 
119
#endif /* _SECITEM_H_ */