本文整理汇总了C++中conf_get_str函数的典型用法代码示例。如果您正苦于以下问题:C++ conf_get_str函数的具体用法?C++ conf_get_str怎么用?C++ conf_get_str使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了conf_get_str函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: proxy_http_negotiate
int proxy_http_negotiate (ProxySocket *p, int change)
{
if (p->state == PROXY_STATE_NEW) {
/* we are just beginning the proxy negotiate process,
* so we'll send off the initial bits of the request.
* for this proxy method, it's just a simple HTTP
* request
*/
char *buf, dest[512];
char *username, *password;
sk_getaddr(p->remote_addr, dest, lenof(dest));
buf = dupprintf("CONNECT %s:%i HTTP/1.1\r\nHost: %s:%i\r\n",
dest, p->remote_port, dest, p->remote_port);
sk_write(p->sub_socket, buf, strlen(buf));
sfree(buf);
username = conf_get_str(p->conf, CONF_proxy_username);
password = conf_get_str(p->conf, CONF_proxy_password);
if (username[0] || password[0]) {
char *buf, *buf2;
int i, j, len;
buf = dupprintf("%s:%s", username, password);
len = strlen(buf);
buf2 = snewn(len * 4 / 3 + 100, char);
sprintf(buf2, "Proxy-Authorization: Basic ");
for (i = 0, j = strlen(buf2); i < len; i += 3, j += 4)
base64_encode_atom((unsigned char *)(buf+i),
(len-i > 3 ? 3 : len-i), buf2+j);
strcpy(buf2+j, "\r\n");
sk_write(p->sub_socket, buf2, strlen(buf2));
sfree(buf);
sfree(buf2);
}
示例2: module_init
static int module_init(void)
{
auth.nonce_expiry = NONCE_EXPIRY;
auth.secret = rand_u64();
conf_get_u32(restund_conf(), "auth_nonce_expiry", &auth.nonce_expiry);
auth.sharedsecret_length = 0;
auth.sharedsecret2_length = 0;
conf_get_str(restund_conf(), "auth_shared", auth.sharedsecret, sizeof(auth.sharedsecret));
auth.sharedsecret_length = strlen(auth.sharedsecret);
conf_get_str(restund_conf(), "auth_shared_rollover", auth.sharedsecret2, sizeof(auth.sharedsecret2));
auth.sharedsecret2_length = strlen(auth.sharedsecret2);
if (auth.sharedsecret_length > 0 || auth.sharedsecret2_length > 0) {
restund_debug("auth: module loaded shared secret lengths %d and %d\n",
auth.sharedsecret_length,
auth.sharedsecret2_length);
}
restund_stun_register_handler(&stun);
restund_debug("auth: module loaded (nonce_expiry=%us)\n",
auth.nonce_expiry);
return 0;
}
示例3: module_init
static int module_init(void)
{
struct list *vidcodecl = baresip_vidcodecl();
char h264enc[64];
char h264dec[64];
#ifdef USE_X264
debug("avcodec: x264 build %d\n", X264_BUILD);
#else
debug("avcodec: using libavcodec H.264 encoder\n");
#endif
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(53, 10, 0)
avcodec_init();
#endif
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58, 9, 100)
avcodec_register_all();
#endif
if (0 == conf_get_str(conf_cur(), "avcodec_h264dec",
h264dec, sizeof(h264dec))) {
info("avcodec: using h264 decoder by name (%s)\n", h264dec);
avcodec_h264dec = avcodec_find_decoder_by_name(h264dec);
if (!avcodec_h264dec) {
warning("avcodec: h264 decoder not found (%s)\n",
h264dec);
return ENOENT;
}
vidcodec_register(vidcodecl, &h264);
}
else {
if (avcodec_find_decoder(AV_CODEC_ID_H264))
vidcodec_register(vidcodecl, &h264);
}
if (avcodec_find_decoder(AV_CODEC_ID_H263))
vidcodec_register(vidcodecl, &h263);
if (avcodec_find_decoder(AV_CODEC_ID_MPEG4))
vidcodec_register(vidcodecl, &mpg4);
if (0 == conf_get_str(conf_cur(), "avcodec_h264enc",
h264enc, sizeof(h264enc))) {
info("avcodec: using h264 encoder by name (%s)\n", h264enc);
avcodec_h264enc = avcodec_find_encoder_by_name(h264enc);
if (!avcodec_h264enc) {
warning("avcodec: h264 encoder not found (%s)\n",
h264enc);
return ENOENT;
}
}
return 0;
}
示例4: x509_crl_init
int
x509_crl_init(void)
{
/*
* XXX I'm not sure if the method to use CRLs in certificate validation
* is valid for OpenSSL versions prior to 0.9.7. For now, simply do not
* support it.
*/
#if OPENSSL_VERSION_NUMBER >= 0x00907000L
char *dirname;
dirname = conf_get_str("X509-certificates", "CRL-directory");
if (!dirname) {
log_print("x509_crl_init: no CRL-directory");
return 0;
}
if (!x509_read_crls_from_dir(x509_cas, dirname)) {
LOG_DBG((LOG_MISC, 10,
"x509_crl_init: x509_read_crls_from_dir failed"));
return 0;
}
#else
LOG_DBG((LOG_CRYPTO, 10, "x509_crl_init: CRL support only "
"with OpenSSL v0.9.7 or later"));
#endif
return 1;
}
示例5: RunConfig
void RunConfig( Conf * conf /*Config * cfg*/ ) {
char b[2048];
char c[180], *cl;
int freecl = FALSE;
BOOL inherit_handles;
STARTUPINFO si;
PROCESS_INFORMATION pi;
HANDLE filemap = NULL;
char bufpass[256] ;
strcpy( bufpass, conf_get_str(conf,CONF_password));
MASKPASS(bufpass);
/*
* Allocate a file-mapping memory chunk for the
* config structure.
*/
SECURITY_ATTRIBUTES sa;
void *p;
int size;
size = conf_serialised_size(conf);
sa.nLength = sizeof(sa);
sa.lpSecurityDescriptor = NULL;
sa.bInheritHandle = TRUE;
filemap = CreateFileMapping(INVALID_HANDLE_VALUE,
&sa,
PAGE_READWRITE,
0, size, NULL);
if (filemap && filemap != INVALID_HANDLE_VALUE) {
p = MapViewOfFile(filemap, FILE_MAP_WRITE, 0, 0, size);
if (p) {
conf_serialise(conf, p);
UnmapViewOfFile(p);
}
}
inherit_handles = TRUE;
sprintf(c, "putty &%p:%u", filemap, (unsigned)size);
cl = c;
memset(bufpass,0,strlen(bufpass));//MASKPASS(cfg->password);
GetModuleFileName(NULL, b, sizeof(b) - 1);
si.cb = sizeof(si);
si.lpReserved = NULL;
si.lpDesktop = NULL;
si.lpTitle = NULL;
si.dwFlags = 0;
si.cbReserved2 = 0;
si.lpReserved2 = NULL;
CreateProcess(b, cl, NULL, NULL, inherit_handles,
NORMAL_PRIORITY_CLASS, NULL, NULL, &si, &pi);
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
if (filemap)
CloseHandle(filemap);
if (freecl)
sfree(cl);
}
示例6: sa_reinit
void
sa_reinit(void)
{
struct sa *sa;
char *tag;
int i;
/* For now; only do this if we have the proper tag configured. */
tag = conf_get_str("General", "Renegotiate-on-HUP");
if (!tag)
return;
LOG_DBG((LOG_SA, 30, "sa_reinit: renegotiating active connections"));
/*
* Get phase 2 SAs. Soft expire those without active exchanges. Do
* not touch a phase 2 SA where the soft expiration is not set, ie.
* the SA is not yet established.
*/
for (i = 0; i <= bucket_mask; i++)
for (sa = LIST_FIRST(&sa_tab[i]); sa; sa = LIST_NEXT(sa, link))
if (sa->phase == 2)
if (exchange_lookup_by_name(sa->name,
sa->phase) == 0 && sa->soft_death) {
timer_remove_event(sa->soft_death);
sa_soft_expire(sa);
}
}
示例7: process_subneg
static void process_subneg(Telnet telnet)
{
unsigned char *b, *p, *q;
int var, value, n, bsize;
char *e, *eval, *ekey, *user;
switch (telnet->sb_opt) {
case TELOPT_TSPEED:
if (telnet->sb_len == 1 && telnet->sb_buf[0] == TELQUAL_SEND) {
char *logbuf;
char *termspeed = conf_get_str(telnet->conf, CONF_termspeed);
b = snewn(20 + strlen(termspeed), unsigned char);
b[0] = IAC;
b[1] = SB;
b[2] = TELOPT_TSPEED;
b[3] = TELQUAL_IS;
strcpy((char *)(b + 4), termspeed);
n = 4 + strlen(termspeed);
b[n] = IAC;
b[n + 1] = SE;
telnet->bufsize = sk_write(telnet->s, (char *)b, n + 2);
logevent(telnet->frontend, "server:\tSB TSPEED SEND");
logbuf = dupprintf("client:\tSB TSPEED IS %s", termspeed);
logevent(telnet->frontend, logbuf);
sfree(logbuf);
sfree(b);
} else
示例8: x509_cert_init
/* Initialize our databases and load our own certificates. */
int
x509_cert_init(void)
{
char *dirname;
x509_hash_init();
/* Process CA certificates we will trust. */
dirname = conf_get_str("X509-certificates", "CA-directory");
if (!dirname) {
log_print("x509_cert_init: no CA-directory");
return 0;
}
/* Free if already initialized. */
if (x509_cas)
X509_STORE_free(x509_cas);
x509_cas = X509_STORE_new();
if (!x509_cas) {
log_print("x509_cert_init: creating new X509_STORE failed");
return 0;
}
if (!x509_read_from_dir(x509_cas, dirname, 0, &n_x509_cas)) {
log_print("x509_cert_init: x509_read_from_dir failed");
return 0;
}
/* Process client certificates we will accept. */
dirname = conf_get_str("X509-certificates", "Cert-directory");
if (!dirname) {
log_print("x509_cert_init: no Cert-directory");
return 0;
}
/* Free if already initialized. */
if (x509_certs)
X509_STORE_free(x509_certs);
x509_certs = X509_STORE_new();
if (!x509_certs) {
log_print("x509_cert_init: creating new X509_STORE failed");
return 0;
}
if (!x509_read_from_dir(x509_certs, dirname, 1, NULL)) {
log_print("x509_cert_init: x509_read_from_dir failed");
return 0;
}
return 1;
}
示例9: custom_get_time_format
static
int
custom_get_time_format(char *s, size_t max)
{
char buff[256];
return copy(s, max, conf_get_str(CONF_FORMAT, buff, sizeof buff, "%R"));
}
示例10: custom_get_timezone
static
int
custom_get_timezone(char *s, size_t max)
{
char buff[256];
conf_get_str(CONF_ZONE, buff, sizeof buff, tz_get());
tz_set(buff);
return copy(s, max, tz_get());
}
示例11: module_init
static int module_init(void)
{
aufilt_register(baresip_aufiltl(), &sndfile);
conf_get_str(conf_cur(), "snd_path", file_path, sizeof(file_path));
info("sndfile: saving files in %s\n", file_path);
return 0;
}
示例12: log_writetimestamp
int log_writetimestamp( struct LogContext *ctx ) {
// "%m/%d/%Y %H:%M:%S "
if( strlen(conf_get_str(ctx->conf,CONF_logtimestamp) /*ctx->cfg.logtimestamp*/)==0 ) return 1 ;
char buf[128] = "" ;
if( poss( "%f", conf_get_str(ctx->conf,CONF_logtimestamp) /*ctx->cfg.logtimestamp*/ ) ) {
SYSTEMTIME sysTime ;
GetLocalTime( &sysTime ) ;
t_strftime( buf, 127, conf_get_str(ctx->conf,CONF_logtimestamp) /*ctx->cfg.logtimestamp*/, sysTime ) ;
}
else {
time_t temps = time( 0 ) ;
struct tm tm = * localtime( &temps ) ;
m_strftime( buf, 127, conf_get_str(ctx->conf,CONF_logtimestamp) /*ctx->cfg.logtimestamp*/, &tm ) ;
}
fwrite(buf, 1, strlen(buf), ctx->lgfp);
return 1;
}
示例13: xyz_StartSending
void xyz_StartSending(Terminal *term)
{
OPENFILENAME fn;
char filenames[32000];
BOOL res;
memset(&fn, 0, sizeof(fn));
memset(filenames, 0, sizeof(filenames));
fn.lStructSize = sizeof(fn);
fn.lpstrFile = filenames;
fn.nMaxFile = sizeof(filenames)-1; // the missing -1 was causing a crash on very long selections
fn.lpstrTitle = "Select files to upload...";
fn.Flags = OFN_ALLOWMULTISELECT | OFN_CREATEPROMPT | OFN_ENABLESIZING | OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_PATHMUSTEXIST;
res = GetOpenFileName(&fn);
if (res)
{
char sz_full_params[32767];
char *p, *curparams;
p = filenames;
curparams = sz_full_params;
sz_full_params[0] = 0;
curparams += sprintf(curparams, "%s", conf_get_str(term->conf,CONF_szoptions));
if (*(p+strlen(filenames)+1)==0) {
sprintf(curparams, " \"%s\"", filenames);
} else {
for (;;) {
p=p+strlen(p)+1;
if (*p==0)
break;
curparams += sprintf(curparams, " \"%s\\%s\"", filenames, p);
}
}
if (xyz_SpawnProcess(term, conf_get_str(term->conf,CONF_szcommand), sz_full_params) == 0) {
term->xyz_transfering = 1;
}
}
}
示例14: rlogin_startup
static void rlogin_startup(Rlogin rlogin, const char *ruser)
{
char z = 0;
char *p;
sk_write(rlogin->s, &z, 1);
p = conf_get_str(rlogin->conf, CONF_localusername);
sk_write(rlogin->s, p, strlen(p));
sk_write(rlogin->s, &z, 1);
sk_write(rlogin->s, ruser, strlen(ruser));
sk_write(rlogin->s, &z, 1);
p = conf_get_str(rlogin->conf, CONF_termtype);
sk_write(rlogin->s, p, strlen(p));
sk_write(rlogin->s, "/", 1);
p = conf_get_str(rlogin->conf, CONF_termspeed);
sk_write(rlogin->s, p, strspn(p, "0123456789"));
rlogin->bufsize = sk_write(rlogin->s, &z, 1);
rlogin->prompt = NULL;
}
示例15: conf_get_str
char *get_remote_username(Conf *conf)
{
char *username = conf_get_str(conf, CONF_username);
if (*username) {
return dupstr(username);
} else if (conf_get_int(conf, CONF_username_from_env)) {
/* Use local username. */
return get_username(); /* might still be NULL */
} else {
return NULL;
}
}