本文整理汇总了C++中cfg_get函数的典型用法代码示例。如果您正苦于以下问题:C++ cfg_get函数的具体用法?C++ cfg_get怎么用?C++ cfg_get使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cfg_get函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: drv_generic_i2c_open
int drv_generic_i2c_open(const char *section, const char *driver)
{
int dev;
char *bus, *device;
udelay_init();
Section = (char *) section;
Driver = (char *) driver;
bus = cfg_get(Section, "Port", NULL);
device = cfg_get(Section, "Device", NULL);
dev = atoi(device);
info("%s: initializing I2C bus %s", Driver, bus);
if ((i2c_device = open(bus, O_WRONLY)) < 0) {
error("%s: I2C bus %s open failed !\n", Driver, bus);
goto exit_error;
}
info("%s: selecting slave device 0x%x", Driver, dev);
if (ioctl(i2c_device, I2C_SLAVE, dev) < 0) {
error("%s: error selecting slave device 0x%x\n", Driver, dev);
goto exit_error;
}
info("%s: initializing I2C slave device 0x%x", Driver, dev);
if (i2c_smbus_write_quick(i2c_device, I2C_SMBUS_WRITE) < 0) {
error("%s: error initializing device 0x%x\n", Driver, dev);
close(i2c_device);
}
return 0;
exit_error:
free(bus);
free(device);
close(i2c_device);
return -1;
}
开发者ID:KP1533TM2,项目名称:lcd4linux,代码行数:35,代码来源:drv_generic_i2c.c
示例2: gw_malloc
/*
* Load all configuration directives that are common for all database
* types that use the 'dlr-db' group to define which attributes are
* used in the table
*/
struct dlr_db_fields *dlr_db_fields_create(CfgGroup *grp)
{
struct dlr_db_fields *ret = NULL;
ret = gw_malloc(sizeof(*ret));
gw_assert(ret != NULL);
memset(ret, 0, sizeof(*ret));
if (!(ret->table = cfg_get(grp, octstr_imm("table"))))
panic(0, "DLR: DB: directive 'table' is not specified!");
if (!(ret->field_smsc = cfg_get(grp, octstr_imm("field-smsc"))))
panic(0, "DLR: DB: directive 'field-smsc' is not specified!");
if (!(ret->field_ts = cfg_get(grp, octstr_imm("field-timestamp"))))
panic(0, "DLR: DB: directive 'field-timestamp' is not specified!");
if (!(ret->field_src = cfg_get(grp, octstr_imm("field-source"))))
panic(0, "DLR: DB: directive 'field-source' is not specified!");
if (!(ret->field_dst = cfg_get(grp, octstr_imm("field-destination"))))
panic(0, "DLR: DB: directive 'field-destination' is not specified!");
if (!(ret->field_serv = cfg_get(grp, octstr_imm("field-service"))))
panic(0, "DLR: DB: directive 'field-service' is not specified!");
if (!(ret->field_url = cfg_get(grp, octstr_imm("field-url"))))
panic(0, "DLR: DB: directive 'field-url' is not specified!");
if (!(ret->field_mask = cfg_get(grp, octstr_imm("field-mask"))))
panic(0, "DLR: DB: directive 'field-mask' is not specified!");
if (!(ret->field_status = cfg_get(grp, octstr_imm("field-status"))))
panic(0, "DLR: DB: directive 'field-status' is not specified!");
if (!(ret->field_boxc = cfg_get(grp, octstr_imm("field-boxc-id"))))
panic(0, "DLR: DB: directive 'field-boxc-id' is not specified!");
return ret;
}
开发者ID:MessagePlus,项目名称:kannel,代码行数:36,代码来源:dlr.c
示例3: blst_add_f
static int blst_add_f(struct sip_msg* msg, char* to, char* foo)
{
#ifdef USE_DST_BLACKLIST
int t;
struct dest_info src;
if (likely(cfg_get(core, core_cfg, use_dst_blacklist))){
t=0;
if (unlikely( to && (get_int_fparam(&t, msg, (fparam_t*)to)<0)))
return -1;
if (t==0)
t=cfg_get(core, core_cfg, blst_timeout);
init_dest_info(&src);
src.send_sock=0;
src.to=msg->rcv.src_su;
src.id=msg->rcv.proto_reserved1;
src.proto=msg->rcv.proto;
dst_blacklist_force_add_to(BLST_ADM_PROHIBITED, &src, msg,
S_TO_TICKS(t));
return 1;
}else{
LOG(L_WARN, "WARNING: blst: blst_add: blacklist support disabled\n");
}
#else /* USE_DST_BLACKLIST */
LOG(L_WARN, "WARNING: blst: blst_add: blacklist support not compiled-in"
" - no effect -\n");
#endif /* USE_DST_BLACKLIST */
return 1;
}
开发者ID:GreenfieldTech,项目名称:kamailio,代码行数:29,代码来源:blst.c
示例4: init_reroute
/*
* Add reroute information to the connection data. Where the priority
* is in the order: reroute, reroute-smsc-id, reroute-receiver.
*/
static void init_reroute(SMSCConn *conn, CfgGroup *grp)
{
Octstr *rule;
long i;
if (cfg_get_bool(&conn->reroute_dlr, grp, octstr_imm("reroute-dlr")) == -1)
conn->reroute_dlr = 0;
info(0, "DLR rerouting for smsc id <%s> %s.", octstr_get_cstr(conn->id), (conn->reroute_dlr?"enabled":"disabled"));
if (cfg_get_bool(&conn->reroute, grp, octstr_imm("reroute")) != -1) {
debug("smscconn",0,"Adding general internal routing for smsc id <%s>",
octstr_get_cstr(conn->id));
return;
}
if ((conn->reroute_to_smsc = cfg_get(grp, octstr_imm("reroute-smsc-id"))) != NULL) {
/* reroute all messages to a specific smsc-id */
debug("smscconn",0,"Adding internal routing: smsc id <%s> to smsc id <%s>",
octstr_get_cstr(conn->id), octstr_get_cstr(conn->reroute_to_smsc));
return;
}
if ((rule = cfg_get(grp, octstr_imm("reroute-receiver"))) != NULL) {
List *routes;
/* create hash disctionary for this smsc-id */
conn->reroute_by_receiver = dict_create(100, (void(*)(void *)) octstr_destroy);
routes = octstr_split(rule, octstr_imm(";"));
for (i = 0; i < list_len(routes); i++) {
Octstr *item = list_get(routes, i);
Octstr *smsc, *receiver;
List *receivers;
/* first word is the smsc-id, all other are the receivers */
receivers = octstr_split(item, octstr_imm(","));
smsc = list_extract_first(receivers);
if (smsc)
octstr_strip_blanks(smsc);
while((receiver = list_extract_first(receivers))) {
octstr_strip_blanks(receiver);
debug("smscconn",0,"Adding internal routing for smsc id <%s>: "
"receiver <%s> to smsc id <%s>",
octstr_get_cstr(conn->id), octstr_get_cstr(receiver),
octstr_get_cstr(smsc));
if (!dict_put_once(conn->reroute_by_receiver, receiver, octstr_duplicate(smsc)))
panic(0, "Could not set internal routing for smsc id <%s>: "
"receiver <%s> to smsc id <%s>, because receiver has already routing entry!",
octstr_get_cstr(conn->id), octstr_get_cstr(receiver),
octstr_get_cstr(smsc));
octstr_destroy(receiver);
}
octstr_destroy(smsc);
list_destroy(receivers, octstr_destroy_item);
}
octstr_destroy(rule);
list_destroy(routes, octstr_destroy_item);
}
}
开发者ID:armic,项目名称:erpts,代码行数:64,代码来源:smscconn.c
示例5: sr_ssl_ctx_info_callback
static void sr_ssl_ctx_info_callback(const SSL *ssl, int event, int ret)
{
struct tls_extra_data* data = 0;
int tls_dbg;
if (event & SSL_CB_HANDSHAKE_START) {
tls_dbg = cfg_get(tls, tls_cfg, debug);
LOG(tls_dbg, "SSL handshake started\n");
if(data==0)
data = (struct tls_extra_data*)SSL_get_app_data(ssl);
if(data->flags & F_TLS_CON_HANDSHAKED) {
LOG(tls_dbg, "SSL renegotiation initiated by client\n");
data->flags |= F_TLS_CON_RENEGOTIATION;
}
}
if (event & SSL_CB_HANDSHAKE_DONE) {
tls_dbg = cfg_get(tls, tls_cfg, debug);
if(data==0)
data = (struct tls_extra_data*)SSL_get_app_data(ssl);
LOG(tls_dbg, "SSL handshake done\n");
/* CVE-2009-3555 - disable renegotiation */
if (ssl->s3) {
LOG(tls_dbg, "SSL disable renegotiation\n");
ssl->s3->flags |= SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS;
}
data->flags |= F_TLS_CON_HANDSHAKED;
}
}
开发者ID:badwtg1111,项目名称:kamailio,代码行数:28,代码来源:tls_domain.c
示例6: conn_config_ssl
void conn_config_ssl (CfgGroup *grp)
{
Octstr *ssl_client_certkey_file = NULL;
Octstr *ssl_server_cert_file = NULL;
Octstr *ssl_server_key_file = NULL;
Octstr *ssl_trusted_ca_file = NULL;
/*
* check if SSL is desired for HTTP servers and then
* load SSL client and SSL server public certificates
* and private keys
*/
ssl_client_certkey_file = cfg_get(grp, octstr_imm("ssl-client-certkey-file"));
if (ssl_client_certkey_file != NULL)
use_global_client_certkey_file(ssl_client_certkey_file);
ssl_server_cert_file = cfg_get(grp, octstr_imm("ssl-server-cert-file"));
ssl_server_key_file = cfg_get(grp, octstr_imm("ssl-server-key-file"));
if (ssl_server_cert_file != NULL && ssl_server_key_file != NULL) {
use_global_server_certkey_file(ssl_server_cert_file,
ssl_server_key_file);
}
ssl_trusted_ca_file = cfg_get(grp, octstr_imm("ssl-trusted-ca-file"));
use_global_trusted_ca_file(ssl_trusted_ca_file);
octstr_destroy(ssl_client_certkey_file);
octstr_destroy(ssl_server_cert_file);
octstr_destroy(ssl_server_key_file);
octstr_destroy(ssl_trusted_ca_file);
}
开发者ID:pwhelan,项目名称:kannel,代码行数:33,代码来源:conn.c
示例7: mem_dump_pkg_cb
/* Dumps pkg memory status.
* Per-child process callback that is called
* when mem_dump_pkg cfg var is changed.
*/
void mem_dump_pkg_cb(str *gname, str *name)
{
int old_memlog;
int memlog;
if (cfg_get(core, core_cfg, mem_dump_pkg) == my_pid()) {
/* set memlog to ALERT level to force
printing the log messages */
old_memlog = cfg_get(core, core_cfg, memlog);
memlog = L_ALERT;
/* ugly hack to temporarily switch memlog to something visible,
* possible race with a parallel cfg_set */
((struct cfg_group_core*)core_cfg)->memlog=memlog;
if (cfg_get(core, core_cfg, mem_summary) & 1) {
LOG(memlog, "Memory status (pkg) of process %d:\n", my_pid());
pkg_status();
}
if (cfg_get(core, core_cfg, mem_summary) & 4) {
LOG(memlog, "Memory still-in-use summary (pkg) of process %d:\n",
my_pid());
pkg_sums();
}
((struct cfg_group_core*)core_cfg)->memlog=old_memlog;
}
}
开发者ID:GreenfieldTech,项目名称:kamailio,代码行数:31,代码来源:pt.c
示例8: init_naptr_proto_prefs
static void init_naptr_proto_prefs()
{
int ignore_rfc, udp, tcp, tls, sctp;
if ((PROTO_UDP > PROTO_LAST) || (PROTO_TCP > PROTO_LAST) ||
(PROTO_TLS > PROTO_LAST) || (PROTO_SCTP > PROTO_LAST)){
BUG("init_naptr_proto_prefs: array too small \n");
return;
}
ignore_rfc = cfg_get(core, core_cfg, dns_naptr_ignore_rfc);
udp = cfg_get(core, core_cfg, dns_udp_pref);
tcp = cfg_get(core, core_cfg, dns_tcp_pref);
tls = cfg_get(core, core_cfg, dns_tls_pref);
sctp = cfg_get(core, core_cfg, dns_sctp_pref);
/* Old implementation ignored the Order field in the NAPTR RR and
* thus violated a MUST in RFC 2915. Currently still the default. */
if (ignore_rfc) {
naptr_proto_pref[PROTO_UDP] = udp;
naptr_proto_pref[PROTO_TCP] = tcp;
naptr_proto_pref[PROTO_TLS] = tls;
naptr_proto_pref[PROTO_SCTP] = sctp;
} else {
/* If value is less than 0, proto is disabled, otherwise
* ignored. */
naptr_proto_pref[PROTO_UDP] = udp < 0 ? udp : 1;
naptr_proto_pref[PROTO_TCP] = tcp < 0 ? tcp : 1;
naptr_proto_pref[PROTO_TLS] = tls < 0 ? tls : 1;
naptr_proto_pref[PROTO_SCTP] = sctp < 0 ? sctp : 1;
}
}
开发者ID:btriller,项目名称:kamailio,代码行数:32,代码来源:resolve.c
示例9: sqlbox_configure_mysql
void sqlbox_configure_mysql(Cfg* cfg)
{
CfgGroup *grp;
Octstr *sql;
if (!(grp = cfg_get_single_group(cfg, octstr_imm("sqlbox"))))
panic(0, "SQLBOX: MySQL: group 'sqlbox' is not specified!");
sqlbox_logtable = cfg_get(grp, octstr_imm("sql-log-table"));
if (sqlbox_logtable == NULL) {
panic(0, "No 'sql-log-table' not configured.");
}
sqlbox_insert_table = cfg_get(grp, octstr_imm("sql-insert-table"));
if (sqlbox_insert_table == NULL) {
panic(0, "No 'sql-insert-table' not configured.");
}
/* create send_sms && sent_sms tables if they do not exist */
sql = octstr_format(SQLBOX_MYSQL_CREATE_LOG_TABLE, sqlbox_logtable);
sql_update(sql);
octstr_destroy(sql);
sql = octstr_format(SQLBOX_MYSQL_CREATE_INSERT_TABLE, sqlbox_insert_table);
sql_update(sql);
octstr_destroy(sql);
/* end table creation */
}
开发者ID:coffeecoco,项目名称:kannel-redis,代码行数:26,代码来源:sqlbox_mysql.c
示例10: dst_blst_mem_info
/* rpc functions */
void dst_blst_mem_info(rpc_t* rpc, void* ctx)
{
if (!cfg_get(core, core_cfg, use_dst_blacklist)){
rpc->fault(ctx, 500, "dst blacklist support disabled");
return;
}
rpc->add(ctx, "dd", *blst_mem_used, cfg_get(core, core_cfg, blst_max_mem));
}
开发者ID:BackupTheBerlios,项目名称:ser,代码行数:9,代码来源:dst_blacklist.c
示例11: init_smpp_server_box
static void init_smpp_server_box(Cfg *cfg) {
CfgGroup *cfg_group;
Octstr *log_file;
long log_level;
log_file = NULL;
log_level = 0;
debug("httpClient", 0, "********** HTTP Client Box Configuration Initialization **********");
/* initialize low level PDUs */
if (smpp_pdu_init(cfg) == -1)
panic(0, "Connot start with PDU init failed.");
/*
* first we take the port number in bearerbox and other values from the
* httpClient group in configuration file
*/
cfg_group = cfg_get_single_group(cfg, octstr_imm("httpClient"));
if (cfg_group == NULL)
panic(0, "No 'httpClient' group in configuration");
httpBoxId = cfg_get(cfg_group, octstr_imm("httpClient-id"));
/* setup logfile stuff */
log_file = cfg_get(cfg_group, octstr_imm("log-file"));
cfg_get_integer(&log_level, cfg_group, octstr_imm("log-level"));
if (log_file != NULL) {
info(0, "Starting to log to file %s level %ld", octstr_get_cstr(log_file), log_level);
log_open(octstr_get_cstr(log_file), log_level, GW_NON_EXCL);
}
if (cfg_get_integer(&timeOut, cfg_group, octstr_imm("time-out")) == -1)
timeOut = TIMEOUT_SECONDS;
integratorId = cfg_get(cfg_group, octstr_imm("integrator-id"));
integratorQueueId = cfg_get(cfg_group, octstr_imm("integrator-queue-id"));
debug("httpClient", 0, "==========Configuration Parameters============");
debug("httpClient", 0, "===> httpClient-id: %s ", octstr_get_cstr(httpBoxId));
debug("httpClient", 0, "===> integrator-id: %s ", octstr_get_cstr(integratorId));
debug("httpClient", 0, "===> integrator-queue-id: %s ", octstr_get_cstr(integratorQueueId));
debug("httpClient", 0, "===> log-file: %s ", octstr_get_cstr(log_file));
debug("httpClient", 0, "===> log-level: %ld", log_level);
debug("httpClient", 0, "===> timeout: %ld ", timeOut);
debug("httpClient", 0, "==============================================");
octstr_destroy(log_file);
gw_smpp_enter(cfg);
httpbox_status = SMPP_RUNNING;
debug("httpClient", 0, "http_status: %d ", httpbox_status);
debug("httpClient", 0, "********** HTTP Client Box Configuration End **********");
}
开发者ID:MessagePlus,项目名称:httpClient,代码行数:57,代码来源:httpClient.c
示例12: get_expire_val
/*! \brief
* Return an expire value in the range [ default_expires - range%, default_expires + range% ]
*/
static inline int get_expire_val(void)
{
int expires = cfg_get(registrar, registrar_cfg, default_expires);
int range = cfg_get(registrar, registrar_cfg, default_expires_range);
/* if no range is given just return default_expires */
if(range == 0) return expires;
/* select a random value in the range */
return expires - (float)range/100 * expires + (float)(rand()%100)/100 * 2 * (float)range/100 * expires;
}
开发者ID:gbour,项目名称:kamailio,代码行数:12,代码来源:sip_msg.c
示例13: tls_h_tcpconn_init
/** init tls specific data in a tcp connection.
* Called when a new tcp connection is accepted or connected.
* It completes the tcp connection initialisation by setting the tls
* specific parts.
* Note that ssl context creation and other expensive operation are left
* out (they are delayed until the first read/write).
* No locking is needed (when the connection is created no other process
* can access it).
* @param c - tcp connection.
* @param sock - socket (unused for now).
* @return 0 on success, < 0 on error.
*/
int tls_h_tcpconn_init(struct tcp_connection *c, int sock)
{
c->type = PROTO_TLS;
c->rcv.proto = PROTO_TLS;
c->timeout = get_ticks_raw() + cfg_get(tls, tls_cfg, con_lifetime);
c->lifetime = cfg_get(tls, tls_cfg, con_lifetime);
c->extra_data = 0;
return 0;
}
开发者ID:albertollamaso,项目名称:kamailio,代码行数:21,代码来源:tls_server.c
示例14: udp_start
int udp_start(Cfg *cfg)
{
CfgGroup *grp;
Octstr *iface;
List *ifs;
int allow_wtls;
if (udp_running) return -1;
debug("bb.udp", 0, "starting UDP sender/receiver module");
grp = cfg_get_single_group(cfg, octstr_imm("core"));
iface = cfg_get(grp, octstr_imm("wdp-interface-name"));
if (iface == NULL) {
error(0, "Missing wdp-interface-name variable, cannot start UDP");
return -1;
}
allow_ip = cfg_get(grp, octstr_imm("udp-allow-ip"));
deny_ip = cfg_get(grp, octstr_imm("udp-deny-ip"));
/* we'll activate WTLS as soon as we have a 'wtls' config group */
grp = cfg_get_single_group(cfg, octstr_imm("wtls"));
allow_wtls = grp != NULL ? 1 : 0;
udpc_list = gwlist_create(); /* have a list of running systems */
ifs = octstr_split(iface, octstr_imm(";"));
octstr_destroy(iface);
while (gwlist_len(ifs) > 0) {
iface = gwlist_extract_first(ifs);
info(0, "Adding interface %s", octstr_get_cstr(iface));
add_service(9200, octstr_get_cstr(iface)); /* wsp */
add_service(9201, octstr_get_cstr(iface)); /* wsp/wtp */
#ifdef HAVE_WTLS_OPENSSL
if (allow_wtls) {
add_service(9202, octstr_get_cstr(iface)); /* wsp/wtls */
add_service(9203, octstr_get_cstr(iface)); /* wsp/wtp/wtls */
}
#else
if (allow_wtls)
error(0, "These is a 'wtls' group in configuration, but no WTLS support compiled in!");
#endif
/* add_service(9204, octstr_get_cstr(interface_name)); * vcard */
/* add_service(9205, octstr_get_cstr(interface_name)); * vcal */
/* add_service(9206, octstr_get_cstr(interface_name)); * vcard/wtls */
/* add_service(9207, octstr_get_cstr(interface_name)); * vcal/wtls */
octstr_destroy(iface);
}
gwlist_destroy(ifs, NULL);
gwlist_add_producer(incoming_wdp);
udp_running = 1;
return 0;
}
开发者ID:Phonebooth,项目名称:kannel,代码行数:56,代码来源:bb_udp.c
示例15: configure_mpd
static int configure_mpd(void)
{
static int configured = 0;
char *s;
if (configured != 0)
return configured;
/* read enabled */
if (cfg_number(Section, "enabled", 0, 0, 1, &plugin_enabled) < 1) {
plugin_enabled = 0;
}
if (plugin_enabled != 1) {
info("[MPD] WARNING: Plugin is not enabled! (set 'enabled 1' to enable this plugin)");
configured = 1;
return configured;
}
/* read server */
s = cfg_get(Section, "server", "localhost");
if (!s || *s == '\0') {
info("[MPD] empty '%s.server' entry from %s, assuming 'localhost'", Section, cfg_source());
strcpy(host, "localhost");
} else
strcpy(host, s);
if (s)
free(s);
/* read port */
if (cfg_number(Section, "port", 6600, 1, 65536, &iport) < 1) {
info("[MPD] no '%s.port' entry from %s using MPD's default", Section, cfg_source());
}
/* read minUpdateTime in ms */
if (cfg_number(Section, "minUpdateTime", 500, 1, 10000, &waittime) < 1) {
info("[MPD] no '%s.minUpdateTime' entry from %s using MPD's default", Section, cfg_source());
}
/* read password */
s = cfg_get(Section, "password", "");
if (!s || *s == '\0') {
info("[MPD] empty '%s.password' entry in %s, assuming none", Section, cfg_source());
memset(pw, 0, sizeof(pw));
} else
strcpy(pw, s);
if (s)
free(s);
debug("[MPD] connection detail: [%s:%d]", host, iport);
configured = 1;
return configured;
}
开发者ID:KCFTech,项目名称:lcd4linux,代码行数:55,代码来源:plugin_mpd.c
示例16: mod_init
/**
* init module function
*/
static int mod_init(void)
{
int fl;
if (_dbg_cfgtrace_facility_str!=NULL)
{
fl = str2facility(_dbg_cfgtrace_facility_str);
if (fl != -1)
{
_dbg_cfgtrace_facility = fl;
} else {
LM_ERR("invalid log facility configured");
return -1;
}
}
if(dbg_init_rpc()!=0)
{
LM_ERR("failed to register RPC commands\n");
return -1;
}
if(cfg_declare("dbg", dbg_cfg_def, &default_dbg_cfg, cfg_sizeof(dbg), &dbg_cfg))
{
LM_ERR("Fail to declare the configuration\n");
return -1;
}
LM_DBG("cfg level_mode:%d hash_size:%d\n",
cfg_get(dbg, dbg_cfg, mod_level_mode),
cfg_get(dbg, dbg_cfg, mod_hash_size));
if(dbg_init_mod_levels(cfg_get(dbg, dbg_cfg, mod_hash_size))<0)
{
LM_ERR("failed to init per module log level\n");
return -1;
}
if(_dbg_log_assign>0)
{
if(dbg_init_pvcache()!=0)
{
LM_ERR("failed to create pvcache\n");
return -1;
}
}
if(_dbg_reset_msgid==1)
{
unsigned int ALL = REQUEST_CB+FAILURE_CB+ONREPLY_CB
+BRANCH_CB+ONSEND_CB+ERROR_CB+LOCAL_CB+EVENT_CB+BRANCH_FAILURE_CB;
if (register_script_cb(dbg_msgid_filter, PRE_SCRIPT_CB|ALL, 0) != 0) {
LM_ERR("could not insert callback");
return -1;
}
}
return dbg_init_bp_list();
}
开发者ID:gbour,项目名称:kamailio,代码行数:58,代码来源:debugger_mod.c
示例17: init_naptr_proto_prefs
void init_naptr_proto_prefs()
{
if ((PROTO_UDP > PROTO_LAST) || (PROTO_TCP > PROTO_LAST) ||
(PROTO_TLS > PROTO_LAST) || (PROTO_SCTP > PROTO_LAST)){
BUG("init_naptr_proto_prefs: array too small \n");
return;
}
naptr_proto_pref[PROTO_UDP]=cfg_get(core, core_cfg, dns_udp_pref);
naptr_proto_pref[PROTO_TCP]=cfg_get(core, core_cfg, dns_tcp_pref);
naptr_proto_pref[PROTO_TLS]=cfg_get(core, core_cfg, dns_tls_pref);
naptr_proto_pref[PROTO_SCTP]=cfg_get(core, core_cfg, dns_sctp_pref);
}
开发者ID:miao606,项目名称:kamailio,代码行数:12,代码来源:resolve.c
示例18: logprint
void
logprint(char *fmt,...)
{
time_t result;
FILE *logptr;
va_list ap;
char *p, *sval, *ts;
int ival;
double dval;
result = time(NULL);
logptr = fopen(cfg_get("logfile"), "a");
if(logptr == NULL) {
fprintf(stderr, "Could not open log file %s for writing\n", cfg_get("logfile"));
return;
}
ts = malloc(255);
strftime(ts, 255, "%Y%m%d %H:%M.%S", localtime(&result));
fprintf(logptr, "%s: ", ts);
va_start(ap, fmt);
for(p = fmt; *p; p++) {
if (*p != '%') {
fputc(*p, logptr);
continue;
}
switch(*++p) {
case 'd':
ival = va_arg(ap, int);
fprintf(logptr, "%d", ival);
break;
case 'f':
dval = va_arg(ap, double);
fprintf(logptr, "%f", dval);
break;
case 's':
for(sval = va_arg(ap, char*); *sval; sval++)
fputc(*sval, logptr);
break;
default:
fputc(*p, logptr);
break;
}
}
va_end(ap);
fclose(logptr);
}
开发者ID:CoherentLogic,项目名称:pbl,代码行数:51,代码来源:log.c
示例19: dst_blst_add
/* Adds a new entry to the blacklist */
void dst_blst_add(rpc_t* rpc, void* ctx)
{
str ip;
int port, proto, flags;
unsigned char err_flags;
struct ip_addr *ip_addr;
if (!cfg_get(core, core_cfg, use_dst_blacklist)){
rpc->fault(ctx, 500, "dst blacklist support disabled");
return;
}
if (rpc->scan(ctx, "Sddd", &ip, &port, &proto, &flags) < 4)
return;
err_flags = (unsigned char)flags;
/* sanity checks */
if ((unsigned char)proto > PROTO_SCTP) {
rpc->fault(ctx, 400, "Unknown protocol");
return;
}
if (err_flags & BLST_IS_IPV6) {
#ifdef USE_IPV6
/* IPv6 address is specified */
ip_addr = str2ip6(&ip);
#else /* USE_IPV6 */
rpc->fault(ctx, 400, "IPv6 support disabled");
return;
#endif /* USE_IPV6 */
} else {
/* try IPv4 first, than IPv6 */
ip_addr = str2ip(&ip);
if (!ip_addr) {
#ifdef USE_IPV6
ip_addr = str2ip6(&ip);
err_flags |= BLST_IS_IPV6;
#else /* USE_IPV6 */
rpc->fault(ctx, 400, "Malformed or IPv6 ip address");
return;
#endif /* USE_IPV6 */
}
}
if (!ip_addr) {
rpc->fault(ctx, 400, "Malformed ip address");
return;
}
if (dst_blacklist_add_ip(err_flags, proto, ip_addr, port,
S_TO_TICKS(cfg_get(core, core_cfg, blst_timeout))))
rpc->fault(ctx, 400, "Failed to add the entry to the blacklist");
}
开发者ID:BackupTheBerlios,项目名称:ser,代码行数:52,代码来源:dst_blacklist.c
示例20: reg_get_crt_max_contacts
int reg_get_crt_max_contacts(void)
{
int n;
sr_xavp_t *ravp=NULL;
sr_xavp_t *vavp=NULL;
str vname = {"max_contacts", 12};
n = 0;
if(reg_xavp_cfg.s!=NULL)
{
ravp = xavp_get(®_xavp_cfg, NULL);
if(ravp!=NULL && ravp->val.type==SR_XTYPE_XAVP)
{
vavp = xavp_get(&vname, ravp->val.v.xavp);
if(vavp!=NULL && vavp->val.type==SR_XTYPE_INT)
{
n = vavp->val.v.i;
LM_ERR("using max contacts value from xavp: %d\n", n);
} else {
ravp = NULL;
}
} else {
ravp = NULL;
}
}
if(ravp==NULL)
{
n = cfg_get(registrar, registrar_cfg, max_contacts);
}
return n;
}
开发者ID:halan,项目名称:kamailio,代码行数:34,代码来源:save.c
注:本文中的cfg_get函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论