]>
Commit | Line | Data |
---|---|---|
cc7c72cd DB |
1 | #ifndef NSS_COMMON_H |
2 | #define NSS_COMMON_H 1 | |
3 | ||
aeb9cc10 DB |
4 | /* Used for parameters with default C++ values which are also called from C */ |
5 | #if defined(c_plusplus) || defined(__cplusplus) | |
6 | #define INIT(v,i) v = (i) | |
7 | #else | |
8 | #define INIT(v,i) v | |
9 | #endif | |
10 | ||
11 | /* These functions are called from both C and C++. */ | |
12 | #if defined(c_plusplus) || defined(__cplusplus) | |
13 | extern "C" { | |
14 | #endif | |
15 | ||
9af478a9 | 16 | #include <pk11func.h> |
52c2652f NMA |
17 | #include "config.h" |
18 | #if ENABLE_NLS | |
3cb0c273 LB |
19 | #include <libintl.h> |
20 | #include <locale.h> | |
52c2652f | 21 | #endif |
3cb0c273 LB |
22 | |
23 | #if ENABLE_NLS | |
24 | #define _(string) gettext(string) | |
25 | #define _N(string, string_plural, count) \ | |
26 | ngettext((string), (string_plural), (count)) | |
27 | #else | |
28 | #define _(string) (string) | |
29 | #define _N(string, string_plural, count) \ | |
30 | ( (count) == 1 ? (string) : (string_plural) ) | |
31 | #endif | |
32 | #define _F(format, ...) autosprintf(_(format), __VA_ARGS__) | |
33 | #define _NF(format, format_plural, count, ...) \ | |
34 | autosprintf(_N((format), (format_plural), (count)), __VA_ARGS__) | |
9af478a9 | 35 | |
aeb9cc10 DB |
36 | char *nssPasswordCallback (PK11SlotInfo *info __attribute ((unused)), |
37 | PRBool retry __attribute ((unused)), | |
38 | void *arg __attribute ((unused))); | |
39 | ||
dff24561 | 40 | SECStatus nssInit (const char *db_path, INIT (int readWrite, 0), INIT (int issueMessage, 1)); |
aeb9cc10 DB |
41 | void nssCleanup (const char *db_path); |
42 | ||
43 | void nsscommon_error (const char *msg, INIT(int logit, 1)); | |
2035bcd4 | 44 | void nssError (void); |
d781daa0 | 45 | |
5ab345f0 DB |
46 | PRInt32 PR_Read_Complete (PRFileDesc *fd, void *buf, PRInt32 requestedBytes); |
47 | ||
aeb9cc10 DB |
48 | #if defined(c_plusplus) || defined(__cplusplus) |
49 | } | |
50 | #endif | |
51 | ||
52 | #if defined(c_plusplus) || defined(__cplusplus) | |
53 | /* These functions are only called from C++ */ | |
54 | #include <string> | |
55 | ||
56 | const char *server_cert_nickname (); | |
57 | std::string server_cert_db_path (); | |
aeb9cc10 | 58 | std::string local_client_cert_db_path (); |
c981acd9 | 59 | std::string add_cert_db_prefix (const std::string &db_path); |
aeb9cc10 DB |
60 | |
61 | void nsscommon_error (const std::string &msg, int logit = 1); | |
62 | ||
63 | void start_log (const char *arg); | |
64 | bool log_ok (); | |
65 | void log (const std::string &msg); | |
66 | void end_log (); | |
67 | ||
68 | int check_cert (const std::string &db_path, const std::string &nss_cert_name, bool use_db_password = false); | |
69 | int gen_cert_db (const std::string &db_path, const std::string &extraDnsNames, bool use_password); | |
70 | SECStatus add_client_cert (const std::string &inFileName, const std::string &db_path); | |
71 | ||
72 | void sign_file ( | |
73 | const std::string &db_path, | |
74 | const std::string &nss_cert_name, | |
75 | const std::string &inputName, | |
76 | const std::string &outputName | |
77 | ); | |
78 | ||
79 | CERTCertList *get_cert_list_from_db (const std::string &cert_nickname); | |
aeb9cc10 | 80 | |
b3367f63 | 81 | SECStatus |
cd1418c7 | 82 | read_cert_info_from_file (const std::string &certPath, |
b3367f63 DS |
83 | std::string &fingerprint); |
84 | ||
aeb9cc10 | 85 | #endif // defined(c_plusplus) || defined(__cplusplus) |
9af478a9 | 86 | |
cc7c72cd DB |
87 | #endif // NSS_COMMON_H |
88 | ||
d781daa0 | 89 | /* vim: set sw=2 ts=8 cino=>4,n-2,{2,^-2,t0,(0,u0,w1,M1 : */ |