本文整理汇总了C++中cw_log函数的典型用法代码示例。如果您正苦于以下问题:C++ cw_log函数的具体用法?C++ cw_log怎么用?C++ cw_log使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cw_log函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: load_module
int load_module(void)
{
char *zErr;
char fn[PATH_MAX];
int res;
/* is the database there? */
snprintf(fn, sizeof(fn), "%s/cdr.db", cw_config_CW_LOG_DIR);
sqlite3_open(fn, &db);
if (!db) {
cw_log(LOG_ERROR, "cdr_sqlite: %s\n", zErr);
free(zErr);
return -1;
}
/* is the table there? */
res = sqlite3_exec(db, "SELECT COUNT(AcctId) FROM cdr;", NULL, NULL, NULL);
if (res) {
res = sqlite3_exec(db, sql_create_table, NULL, NULL, &zErr);
if (res) {
cw_log(LOG_ERROR, "cdr_sqlite: Unable to create table 'cdr': %s\n", zErr);
free(zErr);
goto err;
}
/* TODO: here we should probably create an index */
}
res = cw_cdr_register(name, desc, sqlite_log);
if (res) {
cw_log(LOG_ERROR, "Unable to register SQLite CDR handling\n");
goto err;
}
if (db) sqlite3_close(db);
return 0;
err:
if (db) sqlite3_close(db);
return -1;
}
示例2: h263_write
static int h263_write(struct cw_filestream *fs, struct cw_frame *f)
{
int res;
unsigned int ts;
unsigned short len;
int subclass;
int mark = 0;
if (f->frametype != CW_FRAME_VIDEO)
{
cw_log(LOG_WARNING, "Asked to write non-video frame!\n");
return -1;
}
subclass = f->subclass;
if (subclass & 0x1)
mark=0x8000;
subclass &= ~0x1;
if (subclass != CW_FORMAT_H263)
{
cw_log(LOG_WARNING, "Asked to write non-h263 frame (%d)!\n", f->subclass);
return -1;
}
ts = htonl(f->samples);
if ((res = fwrite(&ts, 1, sizeof(ts), fs->f)) != sizeof(ts))
{
cw_log(LOG_WARNING, "Bad write (%d/4): %s\n", res, strerror(errno));
return -1;
}
len = htons(f->datalen | mark);
if ((res = fwrite(&len, 1, sizeof(len), fs->f)) != sizeof(len))
{
cw_log(LOG_WARNING, "Bad write (%d/2): %s\n", res, strerror(errno));
return -1;
}
if ((res = fwrite(f->data, 1, f->datalen, fs->f)) != f->datalen)
{
cw_log(LOG_WARNING, "Bad write (%d/%d): %s\n", res, f->datalen, strerror(errno));
return -1;
}
return 0;
}
示例3: memset
static struct cw_filestream *slinear_rewrite(FILE *f, const char *comment)
{
/* We don't have any header to read or anything really, but
if we did, it would go here. We also might want to check
and be sure it's a valid file. */
struct cw_filestream *tmp;
if ((tmp = malloc(sizeof(struct cw_filestream)))) {
memset(tmp, 0, sizeof(struct cw_filestream));
if (cw_mutex_lock(&slinear_lock)) {
cw_log(LOG_WARNING, "Unable to lock slinear list\n");
free(tmp);
return NULL;
}
tmp->f = f;
glistcnt++;
cw_mutex_unlock(&slinear_lock);
cw_update_use_count();
} else
cw_log(LOG_WARNING, "Out of memory\n");
return tmp;
}
示例4: xprocess_message
int xprocess_message(struct conn *conn, uint8_t * rawmsg, int rawlen,
struct sockaddr *from)
{
uint8_t *msgptr = rawmsg + cw_get_hdr_msg_offset(rawmsg);
uint32_t type = cw_get_msg_type(msgptr);
cw_log(LOG_ERR, "Hey: %d", type);
if (type == CW_MSG_DISCOVERY_REQUEST)
conn->capwap_state = CW_STATE_DISCOVERY;
return process_message(conn, rawmsg, rawlen, from);
}
示例5: icd_customer__standard_cleanup_caller
/* Standard function for cleaning up a caller after a bridge ends or fails */
icd_status icd_customer__standard_cleanup_caller(icd_caller * that)
{
assert(that != NULL);
if (icd_debug)
cw_log(LOG_DEBUG,
"Caller %d [%s] has a customer role with no pushback needed, exit icd thread finished \n",
icd_caller__get_id(that), icd_caller__get_name(that));
that->thread_state = ICD_THREAD_STATE_FINISHED;
return ICD_SUCCESS;
}
示例6: pcm_write
static int pcm_write(struct cw_filestream *fs, struct cw_frame *f)
{
int res;
if (f->frametype != CW_FRAME_VOICE)
{
cw_log(LOG_WARNING, "Asked to write non-voice frame!\n");
return -1;
}
if (f->subclass != CW_FORMAT_ULAW)
{
cw_log(LOG_WARNING, "Asked to write non-ulaw frame (%d)!\n", f->subclass);
return -1;
}
if ((res = fwrite(f->data, 1, f->datalen, fs->f)) != f->datalen)
{
cw_log(LOG_WARNING, "Bad write (%d/%d): %s\n", res, f->datalen, strerror(errno));
return -1;
}
return 0;
}
示例7: wtpman_run_data
void wtpman_run_data(void *wtpman_arg)
{
return;
struct wtpman *wtpman = (struct wtpman *) wtpman_arg;
struct conn *conn = wtpman->conn;
uint8_t data[1001];
memset(data, 0, 1000);
cw_log(LOG_ERR, "I am the data thread**********************************************************************\n");
while (1) {
sleep(5);
// conn->write_data(conn, data, 100);
cw_log(LOG_ERR, "O was the data thread***********************************************************\n");
}
}
示例8: linear_release
static void linear_release(struct cw_channel *chan, void *params)
{
struct linear_state *ls = params;
if (ls->origwfmt && cw_set_write_format(chan, ls->origwfmt))
{
cw_log(LOG_WARNING, "Unable to restore channel '%s' to format '%d'\n", chan->name, ls->origwfmt);
}
if (ls->autoclose)
close(ls->fd);
free(params);
}
示例9: sccp_pbx_answer
static int sccp_pbx_answer(struct cw_channel *ast) {
sccp_channel_t * c = CS_CW_CHANNEL_PVT(ast);
if (!c || !c->device || !c->line) {
cw_log(LOG_ERROR, "SCCP: Answered %s but no SCCP channel\n", ast->name);
return -1;
}
sccp_log(1)(VERBOSE_PREFIX_3 "SCCP: Outgoing call has been answered %s on %[email protected]%s-%d\n", ast->name, c->line->name, c->device->id, c->callid);
sccp_indicate_lock(c, SCCP_CHANNELSTATE_CONNECTED);
return 0;
}
示例10: add_command_to_queue
int add_command_to_queue (
struct cw_conference *conf, struct cw_conf_member *member ,
int command, int param_number, char *param_text
)
{
struct cw_conf_command_queue *cq, *cq_last;
cq = calloc(1, sizeof( struct cw_conf_command_queue ) ) ;
if ( cq == NULL )
{
cw_log( LOG_ERROR, "unable to malloc cw_conf_command_queue\n" ) ;
return 1 ;
}
cq->next = NULL;
cq->command = command;
cq->issuedby = member;
cq->param_number = param_number;
strncpy(cq->param_text, param_text, sizeof(cq->param_text) );
cw_mutex_lock( &conf->lock ) ;
if ( conf->command_queue == NULL ) {
conf->command_queue = cq;
} else {
cq_last = conf->command_queue;
while ( cq_last->next != NULL )
cq_last = cq_last->next;
cq_last->next = cq;
}
cw_log( CW_CONF_DEBUG, "Conference, name => %s - Added command %d params: '%d/%s'\n",
conf->name, cq->command, cq->param_number, cq->param_text );
cw_mutex_unlock( &conf->lock ) ;
return 1;
}
示例11: database_queue_thread_start
static int database_queue_thread_start(void) {
pthread_attr_t attr;
cw_cond_init(&db_condition_save, NULL);
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
if (cw_pthread_create(&db_thread, &attr, database_queue_thread_main, NULL) < 0) {
cw_log(LOG_ERROR, "Unable to start database queue thread. Using standard (non cached mode).\n");
return -1;
}
return 0;
}
示例12: phase_d_handler
static int phase_d_handler(t30_state_t *s, void *user_data, int result)
{
struct cw_channel *chan;
t30_stats_t t;
chan = (struct cw_channel *) user_data;
if (result)
{
t30_get_transfer_statistics(s, &t);
cw_log(LOG_DEBUG, "==============================================================================\n");
cw_log(LOG_DEBUG, "Pages transferred: %i\n", t.pages_rx);
cw_log(LOG_DEBUG, "Image size: %i x %i\n", t.width, t.length);
cw_log(LOG_DEBUG, "Image resolution %i x %i\n", t.x_resolution, t.y_resolution);
cw_log(LOG_DEBUG, "Transfer Rate: %i\n", t.bit_rate);
cw_log(LOG_DEBUG, "Bad rows %i\n", t.bad_rows);
cw_log(LOG_DEBUG, "Longest bad row run %i\n", t.longest_bad_row_run);
cw_log(LOG_DEBUG, "Compression type %s\n", t4_encoding_to_str(t.encoding));
cw_log(LOG_DEBUG, "Image size (bytes) %i\n", t.image_size);
cw_log(LOG_DEBUG, "==============================================================================\n");
}
return T30_ERR_OK;
}
示例13: group_function_write
static void group_function_write(struct cw_channel *chan, int argc, char **argv, const char *value)
{
char grpcat[256];
if (argc > 0 && argv[0][0]) {
snprintf(grpcat, sizeof(grpcat), "%[email protected]%s", value, argv[0]);
} else {
cw_copy_string(grpcat, value, sizeof(grpcat));
}
if (cw_app_group_set_channel(chan, grpcat))
cw_log(LOG_WARNING, "Setting a group requires an argument (group name)\n");
}
示例14: PGSQL_exec
static int PGSQL_exec(struct cw_channel *chan, int argc, char **argv)
{
struct localuser *u;
int result;
if (argc == 0 || !argv[0][0]) {
cw_log(LOG_WARNING, "APP_PGSQL requires an argument (see manual)\n");
return -1;
}
#if EXTRA_LOG
printf("PRSQL_exec: arg=%s\n", argv[0]);
#endif
LOCAL_USER_ADD(u);
result=0;
if (strncasecmp("connect",argv[0],strlen("connect"))==0) {
result=(aPGSQL_connect(chan,argv[0]));
} else if (strncasecmp("query",argv[0],strlen("query"))==0) {
result=(aPGSQL_query(chan,argv[0]));
} else if (strncasecmp("fetch",argv[0],strlen("fetch"))==0) {
result=(aPGSQL_fetch(chan,argv[0]));
} else if (strncasecmp("reset",argv[0],strlen("reset"))==0) {
result=(aPGSQL_reset(chan,argv[0]));
} else if (strncasecmp("clear",argv[0],strlen("clear"))==0) {
result=(aPGSQL_clear(chan,argv[0]));
} else if (strncasecmp("debug",argv[0],strlen("debug"))==0) {
result=(aPGSQL_debug(chan,argv[0]));
} else if (strncasecmp("disconnect",argv[0],strlen("disconnect"))==0) {
result=(aPGSQL_disconnect(chan,argv[0]));
} else {
cw_log(LOG_WARNING, "Unknown APP_PGSQL argument : %s\n", argv[0]);
result=-1;
}
LOCAL_USER_REMOVE(u);
return result;
}
示例15: register_actions
static int register_actions(struct cw_actiondef *actions, int mode)
{
switch (mode) {
case MOD_MODE_CAPWAP:
{
struct mod_ac *cmod = modload_ac("capwap");
if (!cmod) {
cw_log(LOG_ERR,
"Can't initialize mod_fortinet, failed to load base mod mod_capwap");
return 1;
}
cmod->register_actions(actions, MOD_MODE_CAPWAP);
int rc = fortinet_register_actions_ac(actions);
cw_dbg(DBG_INFO, "Initialized mod fortinet with %d actions", rc);
return 0;
}
case MOD_MODE_BINDINGS:
{
struct mod_ac *cmod = modload_ac("capwap80211");
if (!cmod) {
cw_log(LOG_ERR,
"Can't initialize mod_fortinet, failed to load base mod mod_capwap80211");
return 1;
}
cmod->register_actions(actions, MOD_MODE_BINDINGS);
int rc = fortinet_register_actions80211_ac(actions);
cw_dbg(DBG_INFO, "Initialized mod_fortinet 80211 with %d actions", rc);
return 0;
}
}
return 0;
}