Back to index

lightning-sunbird  0.9+nobinonly
genname.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 _GENAME_H_
00038 #define _GENAME_H_
00039 
00040 #include "plarena.h"
00041 #include "seccomon.h"
00042 #include "secoidt.h"
00043 #include "secasn1.h"
00044 #include "secder.h"
00045 #include "certt.h"
00046 
00047 /************************************************************************/
00048 SEC_BEGIN_PROTOS
00049 
00050 extern const SEC_ASN1Template CERT_GeneralNamesTemplate[];
00051 
00052 extern SECItem **
00053 cert_EncodeGeneralNames(PRArenaPool *arena, CERTGeneralName *names);
00054 
00055 extern CERTGeneralName *
00056 cert_DecodeGeneralNames(PRArenaPool *arena, SECItem **encodedGenName);
00057 
00058 extern SECStatus
00059 cert_DestroyGeneralNames(CERTGeneralName *name);
00060 
00061 extern SECStatus 
00062 cert_EncodeNameConstraints(CERTNameConstraints *constraints, PRArenaPool *arena,
00063                         SECItem *dest);
00064 
00065 extern CERTNameConstraints *
00066 cert_DecodeNameConstraints(PRArenaPool *arena, SECItem *encodedConstraints);
00067 
00068 extern CERTGeneralName *
00069 cert_CombineNamesLists(CERTGeneralName *list1, CERTGeneralName *list2);
00070 
00071 extern CERTNameConstraint *
00072 cert_CombineConstraintsLists(CERTNameConstraint *list1, CERTNameConstraint *list2);
00073 
00074 /*********************************************************************/
00075 /* A thread safe implementation of General Names                     */
00076 /*********************************************************************/
00077 
00078 /* Destroy a Single CERTGeneralName */
00079 void
00080 CERT_DestroyGeneralName(CERTGeneralName *name);
00081 
00082 SECStatus
00083 CERT_CompareGeneralName(CERTGeneralName *a, CERTGeneralName *b);
00084 
00085 SECStatus
00086 CERT_CopyGeneralName(PRArenaPool      *arena, 
00087                    CERTGeneralName  *dest, 
00088                    CERTGeneralName  *src);
00089 
00090 /* General Name Lists are a thread safe, reference counting layer to 
00091  * general names */
00092 
00093 /* Destroys a CERTGeneralNameList */
00094 void
00095 CERT_DestroyGeneralNameList(CERTGeneralNameList *list);
00096 
00097 /* Creates a CERTGeneralNameList */
00098 CERTGeneralNameList *
00099 CERT_CreateGeneralNameList(CERTGeneralName *name);
00100 
00101 /* Compares two CERTGeneralNameList */
00102 SECStatus
00103 CERT_CompareGeneralNameLists(CERTGeneralNameList *a, CERTGeneralNameList *b);
00104 
00105 /* returns a copy of the first name of the type requested */
00106 void *
00107 CERT_GetGeneralNameFromListByType(CERTGeneralNameList *list,
00108                               CERTGeneralNameType type,
00109                               PRArenaPool *arena);
00110 
00111 /* Adds a name to the tail of the list */
00112 void
00113 CERT_AddGeneralNameToList(CERTGeneralNameList *list, 
00114                        CERTGeneralNameType type,
00115                        void *data, SECItem *oid);
00116 
00117 /* returns a duplicate of the CERTGeneralNameList */
00118 CERTGeneralNameList *
00119 CERT_DupGeneralNameList(CERTGeneralNameList *list);
00120 
00121 /* returns the number of CERTGeneralName objects in the  doubly linked
00122 ** list of which *names is a member.
00123 */
00124 extern int
00125 CERT_GetNamesLength(CERTGeneralName *names);
00126 
00127 /************************************************************************/
00128 
00129 SECStatus
00130 CERT_CompareNameSpace(CERTCertificate  *cert,
00131                     CERTGeneralName  *namesList,
00132                     CERTCertificate **certsList,
00133                     PRArenaPool      *arena,
00134                     CERTCertificate **pBadCert);
00135 
00136 SEC_END_PROTOS
00137 
00138 #endif