• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ pomlog函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中pomlog函数的典型用法代码示例。如果您正苦于以下问题:C++ pomlog函数的具体用法?C++ pomlog怎么用?C++ pomlog使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了pomlog函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: analyzer_jpeg_init

static int analyzer_jpeg_init(struct analyzer *analyzer) {

	struct analyzer_pload_type *pload_type = analyzer_pload_type_get_by_name(ANALYZER_JPEG_PLOAD_TYPE);
	
	if (!pload_type) {
		pomlog(POMLOG_ERR "Payload type " ANALYZER_JPEG_PLOAD_TYPE " not found");
		return POM_ERR;
	}

	static struct data_item_reg pload_jpeg_data_items[ANALYZER_JPEG_PLOAD_DATA_COUNT] = { { 0 } };
	pload_jpeg_data_items[analyzer_jpeg_pload_width].name = "width";
	pload_jpeg_data_items[analyzer_jpeg_pload_width].value_type = ptype_get_type("uint16");
	pload_jpeg_data_items[analyzer_jpeg_pload_height].name = "height";
	pload_jpeg_data_items[analyzer_jpeg_pload_height].value_type = ptype_get_type("uint16");
	pload_jpeg_data_items[analyzer_jpeg_pload_exif].name = "exif";
	pload_jpeg_data_items[analyzer_jpeg_pload_exif].flags = ANALYZER_DATA_FLAG_LIST;

	static struct data_reg pload_jpeg_data = {
		.items = pload_jpeg_data_items,
		.data_count = ANALYZER_JPEG_PLOAD_DATA_COUNT
	};

	static struct analyzer_pload_reg pload_reg;
	memset(&pload_reg, 0, sizeof(struct analyzer_pload_reg));
	pload_reg.analyzer = analyzer;
	pload_reg.analyze = analyzer_jpeg_pload_analyze;
	pload_reg.cleanup = analyzer_jpeg_pload_cleanup;
	pload_reg.data_reg = &pload_jpeg_data;
	pload_reg.flags = ANALYZER_PLOAD_PROCESS_PARTIAL;

	return analyzer_pload_register(pload_type, &pload_reg);
}
开发者ID:Astalaseven,项目名称:pom-ng,代码行数:32,代码来源:analyzer_jpeg.c


示例2: ptype_alloc_unit

struct ptype* ptype_alloc_unit(const char* type, char* unit) {

	struct ptype_reg *reg;
	for (reg = ptype_reg_head; reg && strcmp(reg->info->name, type); reg = reg->next);

	if (!reg) {
		// This should only be needed at startup
		pomlog(POMLOG_DEBUG "Ptype of type %s not found, trying to load module", type);
		char ptype_mod_name[64] = { 0 };
		strcat(ptype_mod_name, "ptype_");
		strncat(ptype_mod_name, type, sizeof(ptype_mod_name) - 1 - strlen(ptype_mod_name));
		if (!mod_load(ptype_mod_name)) {
			pomlog(POMLOG_ERR "Ptype of type %s not found", type);
			return NULL;
		}
		for (reg = ptype_reg_head; reg && strcmp(reg->info->name, type); reg = reg->next);
		if (!reg) {
			pomlog(POMLOG_ERR "Ptype of type %s not found even after loading module", type);
			return NULL;
		}
	}
	
	struct ptype *ret = malloc(sizeof(struct ptype));
	if (!ret) {
		pom_oom(sizeof(struct ptype));
		return NULL;
	}

	memset(ret, 0, sizeof(struct ptype));
	ret->type = reg;
	if (reg->info->alloc) {
		if (reg->info->alloc(ret) != POM_OK) {
			pomlog(POMLOG_ERR "Error while allocating ptype %s", type);
			free(ret);
			return NULL;
		}
	}

	if (unit) {
		ret->unit = strdup(unit);
		if (!ret->unit)
			pom_oom(strlen(unit));
	}

	return ret;
}
开发者ID:k0a1a,项目名称:pom-ng,代码行数:46,代码来源:ptype.c


示例3: core_cleanup

int core_cleanup(int emergency_cleanup) {

	core_run = 0;


	int i;
	for (i = 0; i < CORE_PROCESS_THREAD_MAX && core_processing_threads[i]; i++) {
		struct core_processing_thread *t = core_processing_threads[i];
		int res = pthread_cond_signal(&t->pkt_queue_cond);
		if (res) {
			pomlog(POMLOG_ERR "Error while signaling the restart condition : %s", pom_strerror(res));
			abort();
		}
		pthread_join(t->thread, NULL);
		res = pthread_mutex_destroy(&t->pkt_queue_lock);
		if (res)
			pomlog(POMLOG_WARN "Error while destroying a processing thread lock : %s", pom_strerror(res));
		
		res = pthread_cond_destroy(&t->pkt_queue_cond);
		if (res)
			pomlog(POMLOG_WARN "Error while destroying a processing thread condition : %s", pom_strerror(res));


		struct core_packet_queue *tmp = NULL;
		while (t->pkt_queue_head) {
			tmp = t->pkt_queue_head;
			t->pkt_queue_head = tmp->next;
			// packet_pool_cleanup() was already called when the thread stopped
			// packet_pool_release(tmp->pkt);
			free(tmp);
			pomlog(POMLOG_WARN "A packet was still in a thread's queue");
		}

		while (t->pkt_queue_unused) {
			tmp = t->pkt_queue_unused;
			t->pkt_queue_unused = tmp->next;
			// packet_pool_cleanup() was already called when the thread stopped
			// packet_pool_release(tmp->pkt);
			free(tmp);
		}

		free(t);
	}

	return POM_OK;
}
开发者ID:k0a1a,项目名称:pom-ng,代码行数:46,代码来源:core.c


示例4: core_pause_processing

void core_pause_processing() {

	int res = pthread_rwlock_wrlock(&core_processing_lock);
	if (res) {
		pomlog(POMLOG_ERR "Error while locking core processing lock : %s", pom_strerror(res));
		abort();
	}
}
开发者ID:gmsoft-tuxicoman,项目名称:pom-ng,代码行数:8,代码来源:core.c


示例5: pomlog

struct event_reg *event_register(struct event_reg_info *reg_info) {

	struct event_reg *evt;

	// Check if an event with the same name has already been registered
	for (evt = event_reg_head; evt && strcmp(evt->info->name, reg_info->name); evt = evt->next);
	if (evt) {
		pomlog(POMLOG_ERR "An event named %s has already been registered", reg_info->name);
		return NULL;
	}

	// Allocate the event_reg
	evt = malloc(sizeof(struct event_reg));
	if (!evt) {
		pom_oom(sizeof(struct event_reg));
		return NULL;
	}
	memset(evt, 0, sizeof(struct event_reg));

	evt->reg_instance = registry_add_instance(event_registry_class, reg_info->name);
	if (!evt->reg_instance) {
		free(evt);
		return NULL;
	}

	evt->perf_listeners = registry_instance_add_perf(evt->reg_instance, "listeners", registry_perf_type_gauge, "Number of event listeners", "listeners");
	evt->perf_ongoing = registry_instance_add_perf(evt->reg_instance, "ongoing", registry_perf_type_gauge, "Number of ongoing events", "events");
	evt->perf_processed = registry_instance_add_perf(evt->reg_instance, "processed", registry_perf_type_counter, "Number of events fully processed", "events");
	if (!evt->perf_listeners || !evt->perf_ongoing || !evt->perf_processed) {
		registry_remove_instance(evt->reg_instance);
		free(evt);
		return NULL;
	}

	evt->info = reg_info;

	evt->next = event_reg_head;
	if (evt->next)
		evt->next->prev = evt;
	event_reg_head = evt;

	pomlog(POMLOG_DEBUG "Event %s registered", reg_info->name);

	return evt;
}
开发者ID:k0a1a,项目名称:pom-ng,代码行数:45,代码来源:event.c


示例6: proto_cleanup

int proto_cleanup() {

    struct proto *proto;
    for (proto = proto_head; proto; proto = proto->next) {

        if (proto->info->cleanup && proto->info->cleanup(proto->priv) == POM_ERR)
            pomlog(POMLOG_WARN "Error while cleaning up protocol %s", proto->info->name);
        conntrack_table_cleanup(proto->ct);

        mod_refcount_dec(proto->info->mod);
    }

    while (proto_head) {
        proto = proto_head;
        proto_head = proto->next;

        int res = pthread_rwlock_destroy(&proto->listeners_lock);
        if (res)
            pomlog(POMLOG_ERR "Error while destroying the listners lock : %s", pom_strerror(res));
        res = pthread_rwlock_destroy(&proto->expectation_lock);
        if (res)
            pomlog(POMLOG_ERR "Error while destroying the listners lock : %s", pom_strerror(res));


        free(proto);
    }

    if (proto_registry_class)
        registry_remove_class(proto_registry_class);
    proto_registry_class = NULL;

    while (proto_number_class_head) {
        struct proto_number_class *cls = proto_number_class_head;
        proto_number_class_head = cls->next;
        while (cls->nums) {
            struct proto_number *num = cls->nums;
            cls->nums = num->next;
            free(num);
        }
        free(cls->name);
        free(cls);
    }

    return POM_OK;
}
开发者ID:nomnom100,项目名称:pom-ng,代码行数:45,代码来源:proto.c


示例7: core_cleanup

int core_cleanup(int emergency_cleanup) {

	core_run = 0;

	if (!emergency_cleanup) {
		while (core_pkt_queue_head) {
			pomlog("Waiting for all the packets to be processed");
			if (pthread_cond_broadcast(&core_pkt_queue_restart_cond)) {
				pomlog(POMLOG_ERR "Error while signaling the restart condition : %s", pom_strerror(errno));
				return POM_ERR;
			}
			sleep(1);
		}
	}

	if (pthread_cond_broadcast(&core_pkt_queue_restart_cond)) {
		pomlog(POMLOG_ERR "Error while signaling the restart condition : %s", pom_strerror(errno));
		return POM_ERR;
	}

	int i;
	for (i = 0; i < CORE_PROCESS_THREAD_MAX && core_processing_threads[i]; i++) {
		pthread_join(core_processing_threads[i]->thread, NULL);
		free(core_processing_threads[i]);
	}

	pthread_cond_destroy(&core_pkt_queue_restart_cond);

	while (core_pkt_queue_head) {
		struct core_packet_queue *tmp = core_pkt_queue_head;
		core_pkt_queue_head = tmp->next;
		packet_pool_release(tmp->pkt);
		free(tmp);
		pomlog(POMLOG_WARN "A packet was still in the buffer");
	}

	while (core_pkt_queue_unused) {
		struct core_packet_queue *tmp = core_pkt_queue_unused;
		core_pkt_queue_unused = tmp->next;
		free(tmp);
	}

	
	return POM_OK;
}
开发者ID:dkarametos,项目名称:pom-ng,代码行数:45,代码来源:core.c


示例8: addon_log_xml_close

int addon_log_xml_close(void *output_priv) {

    struct output_log_xml_priv *priv = output_priv;

    if (priv->fd == -1) {
        pomlog(POMLOG_ERR "Output already stopped");
        return POM_ERR;
    }

    if (close(priv->fd)) {
        pomlog(POMLOG_ERR "Error while closing log file : %s", pom_strerror(errno));
        return POM_ERR;
    }

    priv->fd = -1;

    return POM_OK;
}
开发者ID:gmsoft-tuxicoman,项目名称:pom-ng,代码行数:18,代码来源:output_log_xml.c


示例9: ptype_copy

int ptype_copy(struct ptype *dst, struct ptype *src) {

	if (dst->type != src->type) {
		pomlog(POMLOG_ERR "Error, trying to copy ptypes of different type");
		return POM_ERR;
	}

	return  src->type->info->copy(dst, src);
}
开发者ID:k0a1a,项目名称:pom-ng,代码行数:9,代码来源:ptype.c


示例10: conntrack_refcount_dec

void conntrack_refcount_dec(struct conntrack_entry *ce) {
	pom_mutex_lock(&ce->lock);
	if (!ce->refcount) {
		pomlog(POMLOG_ERR "Reference count already 0 !");
		abort();
	}
	ce->refcount--;
	pom_mutex_unlock(&ce->lock);
}
开发者ID:elfixit,项目名称:pom-ng,代码行数:9,代码来源:conntrack.c


示例11: registry_perf_timeticks_restart

void registry_perf_timeticks_restart(struct registry_perf *p) {

	if (p->type != registry_perf_type_timeticks) {
		pomlog(POMLOG_ERR "Trying to restart a non timetick performance");
		return;
	}

	if (p->value & REGISTRY_PERF_TIMETICKS_STARTED) {
		pomlog(POMLOG_ERR "Timeticks performance already started");
		return;
	}

	ptime now = pom_gettimeofday();

	// value currently holds the runtime in usec
	volatile uint64_t new_val = (now + REGISTRY_PERF_TIMETICKS_STARTED) - p->value;
	p->value = new_val;
}
开发者ID:k0a1a,项目名称:pom-ng,代码行数:18,代码来源:registry.c


示例12: packet_info_pool_init

int packet_info_pool_init(struct packet_info_pool *pool) {

	if (pthread_mutex_init(&pool->lock, NULL)) {
		pomlog(POMLOG_ERR "Error while initializing the pkt_info_pool lock : ", pom_strerror(errno));
		return POM_ERR;
	}

	return POM_OK;
}
开发者ID:dkarametos,项目名称:pom-ng,代码行数:9,代码来源:packet.c


示例13: event_listener_register

int event_listener_register(struct event_reg *evt_reg, void *obj, int (*process_begin) (struct event *evt, void *obj, struct proto_process_stack *stack, unsigned int stack_index), int (*process_end) (struct event *evt, void *obj)) {

	struct event_listener *lst;
	for (lst = evt_reg->listeners; lst && lst->obj != obj; lst = lst->next);

	if (lst) {
		pomlog(POMLOG_ERR "Event %s is already being listened to by obj %p", evt_reg->info->name, obj);
		return POM_ERR;
	}
	
	
	lst = malloc(sizeof(struct event_listener));
	if (!lst) {
		pom_oom(sizeof(struct event_listener));
		return POM_ERR;

	}
	memset(lst, 0, sizeof(struct event_listener));
	
	lst->obj = obj;
	lst->process_begin = process_begin;
	lst->process_end = process_end;
	
	lst->next = evt_reg->listeners;
	if (lst->next)
		lst->next->prev = lst;

	evt_reg->listeners = lst;

	if (!lst->next) {
		// Got a listener now, notify
		if (evt_reg->info->listeners_notify && evt_reg->info->listeners_notify(evt_reg->info->source_obj, evt_reg, 1) != POM_OK) {
			pomlog(POMLOG_ERR "Error while notifying event object about new listener");
			evt_reg->listeners = NULL;
			free(lst);
			return POM_ERR;
		}
	}

	registry_perf_inc(evt_reg->perf_listeners, 1);
	

	return POM_OK;
}
开发者ID:k0a1a,项目名称:pom-ng,代码行数:44,代码来源:event.c


示例14: registry_perf_timeticks_stop

void registry_perf_timeticks_stop(struct registry_perf *p) {

	if (p->type != registry_perf_type_timeticks) {
		pomlog(POMLOG_ERR "Trying to stop a non timetick performance");
		return;
	}

	if (!(p->value & REGISTRY_PERF_TIMETICKS_STARTED)) {
		pomlog(POMLOG_ERR "Timeticks performance already stopped");
		return;
	}

	ptime now = pom_gettimeofday();

	// value currently holds the absolute start time expressed in usec
	// Not sure if the below is correct ...
	volatile uint64_t new_val = (now + REGISTRY_PERF_TIMETICKS_STARTED) - p->value;
	p->value = new_val;
}
开发者ID:k0a1a,项目名称:pom-ng,代码行数:19,代码来源:registry.c


示例15: input_pcap_dir_open

static int input_pcap_dir_open(struct input *i) {

	struct input_pcap_priv *p = i->priv;

	struct input_pcap_dir_priv *dp = &p->tpriv.dir;

	// Reset the interrupt flag
	dp->interrupt_scan = 0;

	pomlog(POMLOG_INFO "Scanning directory %s for pcap files ...", PTYPE_STRING_GETVAL(dp->p_dir));

	int found = input_pcap_dir_browse(p);

	if (dp->interrupt_scan)
		return POM_ERR;

	if (found == POM_ERR)
		return POM_ERR;

	pomlog(POMLOG_INFO "Found %u files", found);
	
	dp->cur_file = dp->files;

	// Skip files which were not read
	while (dp->cur_file && !dp->cur_file->first_pkt)
		dp->cur_file = dp->cur_file->next;

	if (!dp->cur_file) {
		pomlog(POMLOG_ERR "No useable file found");
		return POM_ERR;
	}

	char errbuf[PCAP_ERRBUF_SIZE + 1] = { 0 };
	p->p = pcap_open_offline(dp->cur_file->full_path, errbuf);
	if (!p->p) {
		pomlog(POMLOG_ERR "Error opening %s for reading", dp->cur_file->full_path);
		return POM_ERR;
	}

	pomlog("Reading file %s", dp->cur_file->filename);

	return input_pcap_common_open(i);
}
开发者ID:elfixit,项目名称:pom-ng,代码行数:43,代码来源:input_pcap.c


示例16: xmlrcpcmd_serial_inc

void xmlrcpcmd_serial_inc() {
	pom_mutex_lock(&xmlrpccmd_serial_lock);
	xmlrpccmd_serial++;
	if (pthread_cond_broadcast(&xmlrpccmd_serial_cond)) {
		pomlog(POMLOG_ERR "Error while signaling the serial condition. Aborting");
		abort();
	}
	pom_mutex_unlock(&xmlrpccmd_serial_lock);

}
开发者ID:Astalaseven,项目名称:pom-ng,代码行数:10,代码来源:xmlrpccmd.c


示例17: conntrack_timer_cleanup

int conntrack_timer_cleanup(struct conntrack_timer *t) {

#ifdef DEBUG_CONNTRACK
	int res = pthread_mutex_lock(&t->ce->lock);

	if (!res) {
		pomlog(POMLOG_ERR "Internal error, conntrack not locked when timer cleaned up");
		pom_mutex_unlock(&t->ce->lock);
	} else if (res != EDEADLK) {
		pomlog(POMLOG_ERR "Error while locking timer lock : %s", pom_strerror(errno));
		abort();
	}
#endif

	timer_cleanup(t->timer);
	free(t);
	return POM_OK;

}
开发者ID:elfixit,项目名称:pom-ng,代码行数:19,代码来源:conntrack.c


示例18: output_file_pload_close

int output_file_pload_close(void *pload_instance_priv) {

	struct output_file_pload_priv *ppriv = pload_instance_priv;
	int fd = ppriv->fd;
	pomlog(POMLOG_DEBUG "File %s closed", ppriv->filename);
	free(ppriv->filename);
	free(ppriv);

	return close(fd);
}
开发者ID:dkarametos,项目名称:pom-ng,代码行数:10,代码来源:output_file.c


示例19: pomlog

struct ptype_reg *ptype_get_type(char *name) {
	struct ptype_reg *tmp;
	
	for (tmp = ptype_reg_head; tmp && strcmp(tmp->info->name, name); tmp = tmp->next);

	if (!tmp)
		pomlog(POMLOG_WARN "Warning, requested ptype %s not found", name);

	return tmp;
}
开发者ID:k0a1a,项目名称:pom-ng,代码行数:10,代码来源:ptype.c


示例20: output_file_pload_write

int output_file_pload_write(void *pload_instance_priv, void *data, size_t len) {


	struct output_file_pload_priv *ppriv = pload_instance_priv;
	int res = pom_write(ppriv->fd, data, len);
	if (res == POM_ERR)
		pomlog(POMLOG_ERR "Error while writing to file %s : %s", ppriv->filename, pom_strerror(errno));

	return res;

}
开发者ID:dkarametos,项目名称:pom-ng,代码行数:11,代码来源:output_file.c



注:本文中的pomlog函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ ponyint_pool_alloc_size函数代码示例发布时间:2022-05-30
下一篇:
C++ pomGetParentWindow函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap