Back to index

lightning-sunbird  0.9+nobinonly
nssbaset.h
Go to the documentation of this file.
00001 /* ***** BEGIN LICENSE BLOCK *****
00002  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00003  *
00004  * The contents of this file are subject to the Mozilla Public License Version
00005  * 1.1 (the "License"); you may not use this file except in compliance with
00006  * the License. You may obtain a copy of the License at
00007  * http://www.mozilla.org/MPL/
00008  *
00009  * Software distributed under the License is distributed on an "AS IS" basis,
00010  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00011  * for the specific language governing rights and limitations under the
00012  * License.
00013  *
00014  * The Original Code is the Netscape security libraries.
00015  *
00016  * The Initial Developer of the Original Code is
00017  * Netscape Communications Corporation.
00018  * Portions created by the Initial Developer are Copyright (C) 1994-2000
00019  * the Initial Developer. All Rights Reserved.
00020  *
00021  * Contributor(s):
00022  *
00023  * Alternatively, the contents of this file may be used under the terms of
00024  * either the GNU General Public License Version 2 or later (the "GPL"), or
00025  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00026  * in which case the provisions of the GPL or the LGPL are applicable instead
00027  * of those above. If you wish to allow use of your version of this file only
00028  * under the terms of either the GPL or the LGPL, and not to allow others to
00029  * use your version of this file under the terms of the MPL, indicate your
00030  * decision by deleting the provisions above and replace them with the notice
00031  * and other provisions required by the GPL or the LGPL. If you do not delete
00032  * the provisions above, a recipient may use your version of this file under
00033  * the terms of any one of the MPL, the GPL or the LGPL.
00034  *
00035  * ***** END LICENSE BLOCK ***** */
00036 
00037 #ifndef NSSBASET_H
00038 #define NSSBASET_H
00039 
00040 #ifdef DEBUG
00041 static const char NSSBASET_CVS_ID[] = "@(#) $RCSfile: nssbaset.h,v $ $Revision: 1.6 $ $Date: 2005/01/20 02:25:45 $";
00042 #endif /* DEBUG */
00043 
00044 /*
00045  * nssbaset.h
00046  *
00047  * This file contains the most low-level, fundamental public types.
00048  */
00049 
00050 #include "nspr.h"
00051 #include "nssilock.h"
00052 
00053 /*
00054  * NSS_EXTERN, NSS_IMPLEMENT, NSS_EXTERN_DATA, NSS_IMPLEMENT_DATA
00055  *
00056  * NSS has its own versions of these NSPR macros, in a form which
00057  * does not confuse ctags and other related utilities.  NSPR 
00058  * defines these macros to take the type as an argument, because
00059  * of a requirement to support win16 dlls.  We do not have that
00060  * requirement, so we can drop that restriction.
00061  */
00062 
00063 #define DUMMY /* dummy */
00064 #define NSS_EXTERN         PR_EXTERN(DUMMY)
00065 #define NSS_IMPLEMENT      PR_IMPLEMENT(DUMMY)
00066 #define NSS_EXTERN_DATA    PR_EXTERN_DATA(DUMMY)
00067 #define NSS_IMPLEMENT_DATA PR_IMPLEMENT_DATA(DUMMY)
00068 
00069 PR_BEGIN_EXTERN_C
00070 
00071 /*
00072  * NSSError
00073  *
00074  * Calls to NSS routines may result in one or more errors being placed
00075  * on the calling thread's "error stack."  Every possible error that
00076  * may be returned from a function is declared where the function is 
00077  * prototyped.  All errors are of the following type.
00078  */
00079 
00080 typedef PRInt32 NSSError;
00081 
00082 /*
00083  * NSSArena
00084  *
00085  * Arenas are logical sets of heap memory, from which memory may be
00086  * allocated.  When an arena is destroyed, all memory allocated within
00087  * that arena is implicitly freed.  These arenas are thread-safe: 
00088  * an arena pointer may be used by multiple threads simultaneously.
00089  * However, as they are not backed by shared memory, they may only be
00090  * used within one process.
00091  */
00092 
00093 struct NSSArenaStr;
00094 typedef struct NSSArenaStr NSSArena;
00095 
00096 /*
00097  * NSSItem
00098  *
00099  * This is the basic type used to refer to an unconstrained datum of
00100  * arbitrary size.
00101  */
00102 
00103 struct NSSItemStr {
00104   void *data;
00105   PRUint32 size;
00106 };
00107 typedef struct NSSItemStr NSSItem;
00108 
00109 
00110 /*
00111  * NSSBER
00112  *
00113  * Data packed according to the Basic Encoding Rules of ASN.1.
00114  */
00115 
00116 typedef NSSItem NSSBER;
00117 
00118 /*
00119  * NSSDER
00120  *
00121  * Data packed according to the Distinguished Encoding Rules of ASN.1;
00122  * this form is also known as the Canonical Encoding Rules form (CER).
00123  */
00124 
00125 typedef NSSBER NSSDER;
00126 
00127 /*
00128  * NSSBitString
00129  *
00130  * Some ASN.1 types use "bit strings," which are passed around as
00131  * octet strings but whose length is counted in bits.  We use this
00132  * typedef of NSSItem to point out the occasions when the length
00133  * is counted in bits, not octets.
00134  */
00135 
00136 typedef NSSItem NSSBitString;
00137 
00138 /*
00139  * NSSUTF8
00140  *
00141  * Character strings encoded in UTF-8, as defined by RFC 2279.
00142  */
00143 
00144 typedef char NSSUTF8;
00145 
00146 /*
00147  * NSSASCII7
00148  *
00149  * Character strings guaranteed to be 7-bit ASCII.
00150  */
00151 
00152 typedef char NSSASCII7;
00153 
00154 PR_END_EXTERN_C
00155 
00156 #endif /* NSSBASET_H */