]>
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 | |
aeb9cc10 DB |
46 | #if defined(c_plusplus) || defined(__cplusplus) |
47 | } | |
48 | #endif | |
49 | ||
50 | #if defined(c_plusplus) || defined(__cplusplus) | |
51 | /* These functions are only called from C++ */ | |
52 | #include <string> | |
53 | ||
54 | const char *server_cert_nickname (); | |
55 | std::string server_cert_db_path (); | |
aeb9cc10 | 56 | std::string local_client_cert_db_path (); |
aeb9cc10 DB |
57 | |
58 | void nsscommon_error (const std::string &msg, int logit = 1); | |
59 | ||
60 | void start_log (const char *arg); | |
61 | bool log_ok (); | |
62 | void log (const std::string &msg); | |
63 | void end_log (); | |
64 | ||
65 | int check_cert (const std::string &db_path, const std::string &nss_cert_name, bool use_db_password = false); | |
66 | int gen_cert_db (const std::string &db_path, const std::string &extraDnsNames, bool use_password); | |
67 | SECStatus add_client_cert (const std::string &inFileName, const std::string &db_path); | |
68 | ||
69 | void sign_file ( | |
70 | const std::string &db_path, | |
71 | const std::string &nss_cert_name, | |
72 | const std::string &inputName, | |
73 | const std::string &outputName | |
74 | ); | |
75 | ||
76 | CERTCertList *get_cert_list_from_db (const std::string &cert_nickname); | |
aeb9cc10 DB |
77 | |
78 | #endif // defined(c_plusplus) || defined(__cplusplus) | |
9af478a9 | 79 | |
cc7c72cd DB |
80 | #endif // NSS_COMMON_H |
81 | ||
d781daa0 | 82 | /* vim: set sw=2 ts=8 cino=>4,n-2,{2,^-2,t0,(0,u0,w1,M1 : */ |