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

« back to all changes in this revision

Viewing changes to mozilla/security/nss/lib/jar/jarint.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
/* JAR internal routines */
 
35
 
 
36
#include "nspr.h"
 
37
 
 
38
/* definitely required */
 
39
/*#include "certdb.h" */
 
40
#include "key.h"
 
41
#include "base64.h"
 
42
 
 
43
extern CERTCertDBHandle *JAR_open_database (void);
 
44
 
 
45
extern int JAR_close_database (CERTCertDBHandle *certdb);
 
46
 
 
47
extern int jar_close_key_database (void *keydb);
 
48
 
 
49
extern void *jar_open_key_database (void);
 
50
 
 
51
extern JAR_Signer *JAR_new_signer (void);
 
52
 
 
53
extern void JAR_destroy_signer (JAR_Signer *signer);
 
54
 
 
55
extern JAR_Signer *jar_get_signer (JAR *jar, char *basename);
 
56
 
 
57
extern int jar_append (ZZList *list, int type,
 
58
   char *pathname, void *data, size_t size);
 
59
 
 
60
/* Translate fopen mode arg to PR_Open flags and mode */
 
61
PRFileDesc*
 
62
JAR_FOPEN_to_PR_Open(const char *name, const char *mode);
 
63
 
 
64
 
 
65
#define ADDITEM(list,type,pathname,data,size) \
 
66
  { int err; err = jar_append (list, type, pathname, data, size); \
 
67
    if (err < 0) return err; }
 
68
 
 
69
/* Here is some ugliness in the event it is necessary to link
 
70
   with NSPR 1.0 libraries, which do not include an FSEEK. It is 
 
71
   difficult to fudge an FSEEK into 1.0 so we use stdio. */
 
72
 
 
73
/* stdio */
 
74
#if 0
 
75
#define JAR_FILE FILE *
 
76
#define JAR_FOPEN(fn,mode) fopen(fn,mode)
 
77
#define JAR_FCLOSE fclose
 
78
#define JAR_FSEEK fseek
 
79
#define JAR_FREAD(fp,buf,siz) fread(buf,1,siz,fp)
 
80
#define JAR_FWRITE(fp,buf,siz) fwrite(buf,1,siz,fp) 
 
81
#endif
 
82
 
 
83
#if 0
 
84
/* nspr 1.0 suite */
 
85
#define JAR_FILE PRFileHandle
 
86
#define JAR_FOPEN(fn,mode) PR_OpenFile(fn,0,mode)
 
87
#define JAR_FCLOSE PR_CLOSE
 
88
#define JAR_FSEEK (no-equivalent)
 
89
#define JAR_FREAD PR_READ
 
90
#define JAR_FWRITE PR_WRITE
 
91
#endif
 
92
 
 
93
/* nspr 2.0 suite */
 
94
#define JAR_FILE PRFileDesc *
 
95
/* #define JAR_FOPEN(fn,mode) PR_Open(fn,0,0) */
 
96
#define JAR_FOPEN(fn,mode) JAR_FOPEN_to_PR_Open(fn,mode)
 
97
#define JAR_FCLOSE PR_Close
 
98
#define JAR_FSEEK PR_Seek
 
99
#define JAR_FREAD PR_Read
 
100
#define JAR_FWRITE PR_Write
 
101
 
 
102
#if 0
 
103
/* nav XP suite, note argument order */
 
104
#define JAR_FILE XP_File
 
105
#define JAR_FOPEN(fn,mode) XP_FileOpen(fn,xpURL,mode)
 
106
#define JAR_FCLOSE XP_FileClose
 
107
#define JAR_FSEEK XP_FileSeek
 
108
#define JAR_FREAD(fp,buf,siz) XP_FileRead(buf,siz,fp)
 
109
#define JAR_FWRITE(fp,buf,siz) XP_FileWrite(buf,siz,fp)
 
110
#endif
 
111
 
 
112
int jar_create_pk7
 
113
   (CERTCertDBHandle *certdb, void *keydb,
 
114
       CERTCertificate *cert, char *password, JAR_FILE infp, 
 
115
       JAR_FILE outfp);
 
116