本文整理汇总了C++中PR_Init函数的典型用法代码示例。如果您正苦于以下问题:C++ PR_Init函数的具体用法?C++ PR_Init怎么用?C++ PR_Init使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PR_Init函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: nss_init
static enum okay
nss_init(void)
{
static int initialized;
char *cp;
verbose = value("verbose") != NULL;
if (initialized == 0) {
if ((cp = value("nss-config-dir")) == NULL) {
fputs("Missing \"nss-config-dir\" variable.\n", stderr);
return STOP;
}
cp = expand(cp);
PR_Init(0, 0, 0);
PK11_SetPasswordFunc(password_cb);
if (NSS_Init(cp) == SECSuccess) {
NSS_SetDomesticPolicy();
initialized = 1;
return OKAY;
}
nss_gen_err("Error initializing NSS");
return STOP;
}
return OKAY;
}
示例2: crypto_init
gboolean
crypto_init (GError **error)
{
SECStatus ret;
if (initialized)
return TRUE;
PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 1);
ret = NSS_NoDB_Init (NULL);
if (ret != SECSuccess) {
g_set_error (error, NM_CRYPTO_ERROR,
NM_CRYPTO_ERROR_FAILED,
_("Failed to initialize the crypto engine: %d."),
PR_GetError ());
PR_Cleanup ();
return FALSE;
}
SEC_PKCS12EnableCipher(PKCS12_RC4_40, 1);
SEC_PKCS12EnableCipher(PKCS12_RC4_128, 1);
SEC_PKCS12EnableCipher(PKCS12_RC2_CBC_40, 1);
SEC_PKCS12EnableCipher(PKCS12_RC2_CBC_128, 1);
SEC_PKCS12EnableCipher(PKCS12_DES_56, 1);
SEC_PKCS12EnableCipher(PKCS12_DES_EDE3_168, 1);
SEC_PKCS12SetPreferredCipher(PKCS12_DES_EDE3_168, 1);
initialized = TRUE;
return TRUE;
}
示例3: main
int main(int argc, char **argv)
{
PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 0);
PR_STDIO_INIT();
if (argc > 1) {
count = atoi(argv[1]);
} else {
count = 5;
}
printf("\n\n%20s%30s\n\n"," ","Suspend_Resume Test");
CreateThreadsUU();
CreateThreadsUK();
CreateThreadsKU();
CreateThreadsKK();
PR_SetConcurrency(2);
printf("\n%20s%30s\n\n"," ","Added 2nd CPU\n");
CreateThreadsUK();
CreateThreadsKK();
CreateThreadsUU();
CreateThreadsKU();
PR_Cleanup();
return 0;
}
示例4: init_qf
static void
init_qf (void)
{
Sys_Init ();
Cvar_Get ("developer", va ("%d", options.developer), 0, 0, 0);
Memory_Init (malloc (1024 * 1024), 1024 * 1024);
Cvar_Get ("pr_debug", "2", 0, 0, 0);
Cvar_Get ("pr_boundscheck", "2", 0, 0, 0);
pr.edicts = &edicts;
pr.num_edicts = &num_edicts;
pr.reserved_edicts = &reserved_edicts;
pr.load_file = load_file;
pr.allocate_progs_mem = allocate_progs_mem;
pr.free_progs_mem = free_progs_mem;
pr.no_exec_limit = 0; // absolutely want a limit!
pr.pr_trace = options.trace;
PR_Init_Cvars ();
PR_Init ();
RUA_Init (&pr, 0);
PR_Cmds_Init(&pr);
BI_Init (&pr);
}
示例5: main
int main(int argc, char **argv) {
int rv;
debug_mode = 1;
PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 0);
PR_SetThreadGCAble();
#ifdef XP_MAC
SetupMacPrintfLog("thrashgc.log");
debug_mode = 1;
#endif
PR_InitGC(0, 0, 0, PR_GLOBAL_THREAD);
PR_STDIO_INIT();
stderrLock = PR_NewLock();
tix1 = PR_RegisterType(&type1);
tix2 = PR_RegisterType(&type2);
tix3 = PR_RegisterType(&type3);
gcInfo = PR_GetGCInfo();
rv = padMain(argc, argv);
printf("PASS\n");
PR_Cleanup();
return rv;
}
示例6: runCmd
static
int runCmd(mainTestFn fnPointer,
int argc,
char **argv,
char *dbPath)
{
int retStat = 0;
/* Initialize NSPR and NSS. */
PR_Init(PR_SYSTEM_THREAD, PR_PRIORITY_NORMAL, 1);
/* if using databases, use NSS_Init and not NSS_NoDB_Init */
if (dbPath && PORT_Strlen(dbPath) != 0) {
if (NSS_Init(dbPath) != SECSuccess)
return SECFailure;
} else {
if (NSS_NoDB_Init(NULL) != 0)
return SECFailure;
}
retStat = fnPointer(argc, argv);
if (NSS_Shutdown() != SECSuccess) {
exit(1);
}
PR_Cleanup();
return retStat;
}
示例7: main
int
main(int argc, char **argv)
{
char * progName = NULL;
SECStatus secStatus;
PLOptState *optstate;
PLOptStatus status;
/* Call the NSPR initialization routines */
PR_Init( PR_SYSTEM_THREAD, PR_PRIORITY_NORMAL, 1);
progName = PL_strdup(argv[0]);
hostName = NULL;
optstate = PL_CreateOptState(argc, argv, "d:h:i:o:p:t:");
while ((status = PL_GetNextOpt(optstate)) == PL_OPT_OK)
{
switch(optstate->option)
{
case 'd' : certDir = PL_strdup(optstate->value); break;
case 'h' : hostName = PL_strdup(optstate->value); break;
case 'i' : infileName = PL_strdup(optstate->value); break;
case 'o' : outfileName = PL_strdup(optstate->value); break;
case 'p' : port = PORT_Atoi(optstate->value); break;
case 't' : trustNewServer_p = PL_strdup(optstate->value); break;
case '?' :
default : Usage(progName);
}
}
if (port == 0 || hostName == NULL || infileName == NULL || outfileName == NULL || certDir == NULL)
Usage(progName);
#if 0 /* no client authentication */
/* Set our password function callback. */
PK11_SetPasswordFunc(myPasswd);
#endif
/* Initialize the NSS libraries. */
secStatus = NSS_InitReadWrite(certDir);
if (secStatus != SECSuccess)
{
/* Try it again, readonly. */
secStatus = NSS_Init(certDir);
if (secStatus != SECSuccess)
exitErr("Error initializing NSS", GENERAL_ERROR);
}
/* All cipher suites except RSA_NULL_MD5 are enabled by Domestic Policy. */
NSS_SetDomesticPolicy();
client_main(port);
NSS_Shutdown();
PR_Cleanup();
return 0;
}
示例8: ssl_nss_init_nss
static void
ssl_nss_init_nss(void)
{
#if NSS_VMAJOR > 3 || ( NSS_VMAJOR == 3 && NSS_VMINOR >= 14 )
SSLVersionRange supported, enabled;
#endif /* NSS >= 3.14 */
PR_Init(PR_SYSTEM_THREAD, PR_PRIORITY_NORMAL, 1);
NSS_NoDB_Init(".");
NSS_SetDomesticPolicy();
SSL_CipherPrefSetDefault(TLS_DHE_RSA_WITH_AES_256_CBC_SHA, 1);
SSL_CipherPrefSetDefault(TLS_DHE_DSS_WITH_AES_256_CBC_SHA, 1);
SSL_CipherPrefSetDefault(TLS_RSA_WITH_AES_256_CBC_SHA, 1);
SSL_CipherPrefSetDefault(TLS_DHE_DSS_WITH_RC4_128_SHA, 1);
SSL_CipherPrefSetDefault(TLS_DHE_RSA_WITH_AES_128_CBC_SHA, 1);
SSL_CipherPrefSetDefault(TLS_DHE_DSS_WITH_AES_128_CBC_SHA, 1);
SSL_CipherPrefSetDefault(SSL_RSA_WITH_RC4_128_SHA, 1);
SSL_CipherPrefSetDefault(TLS_RSA_WITH_AES_128_CBC_SHA, 1);
SSL_CipherPrefSetDefault(SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA, 1);
SSL_CipherPrefSetDefault(SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA, 1);
SSL_CipherPrefSetDefault(SSL_DHE_RSA_WITH_DES_CBC_SHA, 1);
SSL_CipherPrefSetDefault(SSL_DHE_DSS_WITH_DES_CBC_SHA, 1);
#if NSS_VMAJOR > 3 || ( NSS_VMAJOR == 3 && NSS_VMINOR >= 14 )
/* Get the ranges of supported and enabled SSL versions */
if ((SSL_VersionRangeGetSupported(ssl_variant_stream, &supported) == SECSuccess) &&
(SSL_VersionRangeGetDefault(ssl_variant_stream, &enabled) == SECSuccess)) {
purple_debug_info("nss", "TLS supported versions: "
"0x%04hx through 0x%04hx\n", supported.min, supported.max);
purple_debug_info("nss", "TLS versions allowed by default: "
"0x%04hx through 0x%04hx\n", enabled.min, enabled.max);
/* Make sure SSL 3.0 is disabled (it's old and everyone should be
using at least TLS 1.0 by now), and make sure all versions of TLS
supported by the local library are enabled (for some reason NSS
doesn't enable newer versions of TLS by default -- more context in
ticket #15909). */
if (enabled.min != SSL_LIBRARY_VERSION_TLS_1_0 || supported.max > enabled.max) {
enabled.max = supported.max;
if (SSL_VersionRangeSetDefault(ssl_variant_stream, &enabled) == SECSuccess) {
purple_debug_info("nss", "Changed allowed TLS versions to "
"0x%04hx through 0x%04hx\n", enabled.min, enabled.max);
} else {
purple_debug_error("nss", "Error setting allowed TLS versions to "
"0x%04hx through 0x%04hx\n", enabled.min, enabled.max);
}
}
}
#endif /* NSS >= 3.14 */
/** Disable OCSP Checking until we can make that use our HTTP & Proxy stuff */
CERT_EnableOCSPChecking(PR_FALSE);
_identity = PR_GetUniqueIdentity("Purple");
_nss_methods = PR_GetDefaultIOMethods();
}
示例9: Curl_nss_init
/**
* Global SSL init
*
* @retval 0 error initializing SSL
* @retval 1 SSL initialized successfully
*/
int Curl_nss_init(void)
{
if(!initialized)
PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 256);
/* We will actually initialize NSS later */
return 1;
}
示例10: main
int main(int argc, char **argv)
{
PRThread *r, *w;
PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 0);
PR_STDIO_INIT();
emptyBufs = PR_NewSem(2); /* two empty buffers */
fullBufs = PR_NewSem(0); /* zero full buffers */
/* Create initial temp file setup */
InitialSetup();
/* create the reader thread */
r = PR_CreateThread(PR_USER_THREAD,
reader, t1,
PR_PRIORITY_NORMAL,
PR_LOCAL_THREAD,
PR_JOINABLE_THREAD,
0);
w = PR_CreateThread(PR_USER_THREAD,
writer, t2,
PR_PRIORITY_NORMAL,
PR_LOCAL_THREAD,
PR_JOINABLE_THREAD,
0);
/* Do the joining for both threads */
(void) PR_JoinThread(r);
(void) PR_JoinThread(w);
/* Do the verification and clean up */
VerifyAndCleanup();
PR_DestroySem(emptyBufs);
PR_DestroySem(fullBufs);
PR_Cleanup();
if(failed_already)
{
printf("Fail\n");
return 1;
}
else
{
printf("PASS\n");
return 0;
}
}
示例11: main
int main(int argc, char **argv)
{
PRInt32 initial_threads = DEFAULT_INITIAL_THREADS;
PRInt32 max_threads = DEFAULT_MAX_THREADS;
PRInt32 stacksize = DEFAULT_STACKSIZE;
PRThreadPool *tp = NULL;
PRStatus rv;
PRJob *jobp;
/*
* -d debug mode
*/
PLOptStatus os;
PLOptState *opt;
program_name = argv[0];
opt = PL_CreateOptState(argc, argv, "d");
while (PL_OPT_EOL != (os = PL_GetNextOpt(opt)))
{
if (PL_OPT_BAD == os) continue;
switch (opt->option)
{
case 'd': /* debug mode */
_debug_on = 1;
break;
default:
break;
}
}
PL_DestroyOptState(opt);
PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 0);
PR_STDIO_INIT();
PR_SetConcurrency(4);
tp = PR_CreateThreadPool(initial_threads, max_threads, stacksize);
if (NULL == tp) {
printf("PR_CreateThreadPool failed\n");
failed_already=1;
goto done;
}
jobp = PR_QueueJob(tp, TCP_Server, tp, PR_TRUE);
rv = PR_JoinJob(jobp);
PR_ASSERT(PR_SUCCESS == rv);
DPRINTF(("%s: calling PR_JoinThreadPool\n", program_name));
rv = PR_JoinThreadPool(tp);
PR_ASSERT(PR_SUCCESS == rv);
DPRINTF(("%s: returning from PR_JoinThreadPool\n", program_name));
done:
PR_Cleanup();
if (failed_already) return 1;
else return 0;
}
示例12: Host_Init
/*
====================
Host_Init
====================
*/
void Host_Init (quakeparms_t *parms)
{
if (standard_quake)
minimum_memory = MINIMUM_MEMORY;
else
minimum_memory = MINIMUM_MEMORY_LEVELPAK;
if (COM_CheckParm ("-minmemory"))
parms->memsize = minimum_memory;
host_parms = *parms;
if (parms->memsize < minimum_memory)
Sys_Error ("Only %4.1f megs of memory available, can't execute game", parms->memsize / (float)0x100000);
com_argc = parms->argc;
com_argv = parms->argv;
// JPG 3.00 - moved this here
#ifdef _WIN32
srand(time(NULL) ^ _getpid());
#else
srand(time(NULL) ^ getpid());
#endif
Memory_Init (parms->membase, parms->memsize);
Cbuf_Init ();
Cmd_Init ();
Cvar_Init ();
COM_Init (parms->basedir);
Host_InitLocal ();
W_LoadWadFile ("gfx.wad");
Con_Init ();
PR_Init ();
Mod_Init ();
Security_Init (); // JPG 3.20 - cheat free
NET_Init ();
SV_Init ();
IPLog_Init (); // JPG 1.05 - ip address logging
BANLog_Init ();
Con_Printf ("Exe: "__TIME__" "__DATE__"\n");
Con_Printf ("%4.1f megabyte heap\n",parms->memsize/ (1024*1024.0));
R_InitTextures (); // needed even for dedicated servers
Cbuf_InsertText ("exec autoexec.cfg;exec server.cfg;stuffcmds;startdemos\n");
Hunk_AllocName (0, "-HOST_HUNKLEVEL-");
host_hunklevel = Hunk_LowMark ();
host_initialized = true;
Sys_Printf ("========Quake Initialized========\n");
}
示例13: SV_Init
/*
====================
SV_Init
====================
*/
void SV_Init (void)
{
PR_Init ();
SV_InitLocal ();
if (dedicated)
NET_ServerConfig (true);
svs.last_heartbeat = -99999; // send immediately
}
示例14: ssl_init
void ssl_init(void)
{
PR_Init(PR_SYSTEM_THREAD, PR_PRIORITY_NORMAL, 1);
// https://www.mozilla.org/projects/security/pki/nss/ref/ssl/sslfnc.html#1234224
// This NSS function is not intended for use with SSL, which
// requires that the certificate and key database files be
// opened. Relates to whole non-verification of servers for now.
NSS_NoDB_Init(NULL);
NSS_SetDomesticPolicy();
initialized = TRUE;
}
示例15: Curl_nss_init
/**
* Global SSL init
*
* @retval 0 error initializing SSL
* @retval 1 SSL initialized successfully
*/
int Curl_nss_init(void)
{
/* curl_global_init() is not thread-safe so this test is ok */
if (nss_initlock == NULL) {
PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 256);
nss_initlock = PR_NewLock();
}
/* We will actually initialize NSS later */
return 1;
}