本文整理汇总了C++中Listener::extractor方法的典型用法代码示例。如果您正苦于以下问题:C++ Listener::extractor方法的具体用法?C++ Listener::extractor怎么用?C++ Listener::extractor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Listener
的用法示例。
在下文中一共展示了Listener::extractor方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: lua_tap_packet
static tap_packet_status lua_tap_packet(void *tapdata, packet_info *pinfo, epan_dissect_t *edt, const void *data) {
Listener tap = (Listener)tapdata;
tap_packet_status retval = TAP_PACKET_DONT_REDRAW;
TreeItem lua_tree_tap;
if (tap->packet_ref == LUA_NOREF) return TAP_PACKET_DONT_REDRAW; /* XXX - report error and return TAP_PACKET_FAILED? */
lua_settop(tap->L,0);
lua_pushcfunction(tap->L,tap_packet_cb_error_handler);
lua_rawgeti(tap->L, LUA_REGISTRYINDEX, tap->packet_ref);
push_Pinfo(tap->L, pinfo);
push_Tvb(tap->L, edt->tvb);
if (tap->extractor) {
tap->extractor(tap->L,data);
} else {
lua_pushnil(tap->L);
}
lua_pinfo = pinfo;
lua_tvb = edt->tvb;
lua_tree_tap = create_TreeItem(edt->tree, NULL);
lua_tree = lua_tree_tap;
switch ( lua_pcall(tap->L,3,1,1) ) {
case 0:
/* XXX - treat 2 as TAP_PACKET_FAILED? */
retval = luaL_optinteger(tap->L,-1,1) == 0 ? TAP_PACKET_DONT_REDRAW : TAP_PACKET_REDRAW;
break;
case LUA_ERRRUN:
/* XXX - TAP_PACKET_FAILED? */
break;
case LUA_ERRMEM:
g_warning("Memory alloc error while calling listener tap callback packet");
/* XXX - TAP_PACKET_FAILED? */
break;
default:
g_assert_not_reached();
break;
}
clear_outstanding_Pinfo();
clear_outstanding_Tvb();
lua_pinfo = NULL;
lua_tvb = NULL;
lua_tree = NULL;
g_free(lua_tree_tap);
return retval;
}
示例2: lua_tap_packet
static int lua_tap_packet(void *tapdata, packet_info *pinfo, epan_dissect_t *edt, const void *data) {
Listener tap = (Listener)tapdata;
int retval = 0;
if (tap->packet_ref == LUA_NOREF) return 0;
lua_settop(tap->L,0);
lua_pushcfunction(tap->L,tap_packet_cb_error_handler);
lua_rawgeti(tap->L, LUA_REGISTRYINDEX, tap->packet_ref);
push_Pinfo(tap->L, pinfo);
push_Tvb(tap->L, edt->tvb);
if (tap->extractor) {
tap->extractor(tap->L,data);
} else {
lua_pushnil(tap->L);
}
lua_pinfo = pinfo;
lua_tvb = edt->tvb;
lua_tree = (struct _wslua_treeitem *)g_malloc(sizeof(struct _wslua_treeitem));
lua_tree->tree = edt->tree;
lua_tree->item = NULL;
lua_tree->expired = FALSE;
switch ( lua_pcall(tap->L,3,1,1) ) {
case 0:
retval = luaL_optint(tap->L,-1,1);
break;
case LUA_ERRRUN:
break;
case LUA_ERRMEM:
g_warning("Memory alloc error while calling listener tap callback packet");
break;
default:
g_assert_not_reached();
break;
}
clear_outstanding_Pinfo();
clear_outstanding_Tvb();
lua_pinfo = NULL;
lua_tvb = NULL;
lua_tree = NULL;
return retval;
}