/gecko_api/include/nssbaset.h
C++ Header | 156 lines | 28 code | 26 blank | 102 comment | 0 complexity | 2d7595964dd4c3c068fa0ded5a791cb4 MD5 | raw file
1/* ***** BEGIN LICENSE BLOCK ***** 2 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 3 * 4 * The contents of this file are subject to the Mozilla Public License Version 5 * 1.1 (the "License"); you may not use this file except in compliance with 6 * the License. You may obtain a copy of the License at 7 * http://www.mozilla.org/MPL/ 8 * 9 * Software distributed under the License is distributed on an "AS IS" basis, 10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 11 * for the specific language governing rights and limitations under the 12 * License. 13 * 14 * The Original Code is the Netscape security libraries. 15 * 16 * The Initial Developer of the Original Code is 17 * Netscape Communications Corporation. 18 * Portions created by the Initial Developer are Copyright (C) 1994-2000 19 * the Initial Developer. All Rights Reserved. 20 * 21 * Contributor(s): 22 * 23 * Alternatively, the contents of this file may be used under the terms of 24 * either the GNU General Public License Version 2 or later (the "GPL"), or 25 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), 26 * in which case the provisions of the GPL or the LGPL are applicable instead 27 * of those above. If you wish to allow use of your version of this file only 28 * under the terms of either the GPL or the LGPL, and not to allow others to 29 * use your version of this file under the terms of the MPL, indicate your 30 * decision by deleting the provisions above and replace them with the notice 31 * and other provisions required by the GPL or the LGPL. If you do not delete 32 * the provisions above, a recipient may use your version of this file under 33 * the terms of any one of the MPL, the GPL or the LGPL. 34 * 35 * ***** END LICENSE BLOCK ***** */ 36 37#ifndef NSSBASET_H 38#define NSSBASET_H 39 40#ifdef DEBUG 41static const char NSSBASET_CVS_ID[] = "@(#) $RCSfile: nssbaset.h,v $ $Revision: 1.6 $ $Date: 2005/01/20 02:25:45 $"; 42#endif /* DEBUG */ 43 44/* 45 * nssbaset.h 46 * 47 * This file contains the most low-level, fundamental public types. 48 */ 49 50#include "nspr.h" 51#include "nssilock.h" 52 53/* 54 * NSS_EXTERN, NSS_IMPLEMENT, NSS_EXTERN_DATA, NSS_IMPLEMENT_DATA 55 * 56 * NSS has its own versions of these NSPR macros, in a form which 57 * does not confuse ctags and other related utilities. NSPR 58 * defines these macros to take the type as an argument, because 59 * of a requirement to support win16 dlls. We do not have that 60 * requirement, so we can drop that restriction. 61 */ 62 63#define DUMMY /* dummy */ 64#define NSS_EXTERN PR_EXTERN(DUMMY) 65#define NSS_IMPLEMENT PR_IMPLEMENT(DUMMY) 66#define NSS_EXTERN_DATA PR_EXTERN_DATA(DUMMY) 67#define NSS_IMPLEMENT_DATA PR_IMPLEMENT_DATA(DUMMY) 68 69PR_BEGIN_EXTERN_C 70 71/* 72 * NSSError 73 * 74 * Calls to NSS routines may result in one or more errors being placed 75 * on the calling thread's "error stack." Every possible error that 76 * may be returned from a function is declared where the function is 77 * prototyped. All errors are of the following type. 78 */ 79 80typedef PRInt32 NSSError; 81 82/* 83 * NSSArena 84 * 85 * Arenas are logical sets of heap memory, from which memory may be 86 * allocated. When an arena is destroyed, all memory allocated within 87 * that arena is implicitly freed. These arenas are thread-safe: 88 * an arena pointer may be used by multiple threads simultaneously. 89 * However, as they are not backed by shared memory, they may only be 90 * used within one process. 91 */ 92 93struct NSSArenaStr; 94typedef struct NSSArenaStr NSSArena; 95 96/* 97 * NSSItem 98 * 99 * This is the basic type used to refer to an unconstrained datum of 100 * arbitrary size. 101 */ 102 103struct NSSItemStr { 104 void *data; 105 PRUint32 size; 106}; 107typedef struct NSSItemStr NSSItem; 108 109 110/* 111 * NSSBER 112 * 113 * Data packed according to the Basic Encoding Rules of ASN.1. 114 */ 115 116typedef NSSItem NSSBER; 117 118/* 119 * NSSDER 120 * 121 * Data packed according to the Distinguished Encoding Rules of ASN.1; 122 * this form is also known as the Canonical Encoding Rules form (CER). 123 */ 124 125typedef NSSBER NSSDER; 126 127/* 128 * NSSBitString 129 * 130 * Some ASN.1 types use "bit strings," which are passed around as 131 * octet strings but whose length is counted in bits. We use this 132 * typedef of NSSItem to point out the occasions when the length 133 * is counted in bits, not octets. 134 */ 135 136typedef NSSItem NSSBitString; 137 138/* 139 * NSSUTF8 140 * 141 * Character strings encoded in UTF-8, as defined by RFC 2279. 142 */ 143 144typedef char NSSUTF8; 145 146/* 147 * NSSASCII7 148 * 149 * Character strings guaranteed to be 7-bit ASCII. 150 */ 151 152typedef char NSSASCII7; 153 154PR_END_EXTERN_C 155 156#endif /* NSSBASET_H */