本文整理汇总了C++中wmem_new函数的典型用法代码示例。如果您正苦于以下问题:C++ wmem_new函数的具体用法?C++ wmem_new怎么用?C++ wmem_new使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wmem_new函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mncp_hash_insert
static mncp_rhash_value*
mncp_hash_insert(conversation_t *conversation, guint32 nwconnection, guint8 nwtask, packet_info *pinfo)
{
mncp_rhash_key *key;
mncp_rhash_value *value;
/* Now remember the request, so we can find it if we later
a reply to it. Track by conversation, connection, and task number.
in NetWare these values determine each unique session */
key = wmem_new(wmem_file_scope(), mncp_rhash_key);
key->conversation = conversation;
key->nwconnection = nwconnection;
key->nwtask = nwtask;
value = wmem_new(wmem_file_scope(), mncp_rhash_value);
g_hash_table_insert(mncp_rhash, key, value);
if (ncp_echo_conn && nwconnection != 65535) {
expert_add_info_format(pinfo, NULL, &ei_ncp_new_server_session, "Detected New Server Session. Connection %d, Task %d", nwconnection, nwtask);
value->session_start_packet_num = pinfo->fd->num;
}
return value;
}
示例2: new_h225ras_call
h225ras_call_t * new_h225ras_call(h225ras_call_info_key *h225ras_call_key, packet_info *pinfo, e_guid_t *guid, int category)
{
h225ras_call_info_key *new_h225ras_call_key;
h225ras_call_t *h225ras_call = NULL;
/* Prepare the value data.
"req_num" and "rsp_num" are frame numbers;
frame numbers are 1-origin, so we use 0
to mean "we don't yet know in which frame
the reply for this call appears". */
new_h225ras_call_key = wmem_new(wmem_file_scope(), h225ras_call_info_key);
new_h225ras_call_key->reqSeqNum = h225ras_call_key->reqSeqNum;
new_h225ras_call_key->conversation = h225ras_call_key->conversation;
h225ras_call = wmem_new(wmem_file_scope(), h225ras_call_t);
h225ras_call->req_num = pinfo->fd->num;
h225ras_call->rsp_num = 0;
h225ras_call->requestSeqNum = h225ras_call_key->reqSeqNum;
h225ras_call->responded = FALSE;
h225ras_call->next_call = NULL;
h225ras_call->req_time=pinfo->fd->abs_ts;
h225ras_call->guid=*guid;
/* store it */
g_hash_table_insert(ras_calls[category], new_h225ras_call_key, h225ras_call);
return h225ras_call;
}
示例3: wmem_allocator_force_new
/* A local copy of wmem_allocator_new that ignores the
* WIRESHARK_DEBUG_WMEM_OVERRIDE variable so that test functions are
* guaranteed to actually get the allocator type they asked for */
static wmem_allocator_t *
wmem_allocator_force_new(const wmem_allocator_type_t type)
{
wmem_allocator_t *allocator;
allocator = wmem_new(NULL, wmem_allocator_t);
allocator->type = type;
allocator->callbacks = NULL;
allocator->in_scope = TRUE;
switch (type) {
case WMEM_ALLOCATOR_SIMPLE:
wmem_simple_allocator_init(allocator);
break;
case WMEM_ALLOCATOR_BLOCK:
wmem_block_allocator_init(allocator);
break;
case WMEM_ALLOCATOR_BLOCK_FAST:
wmem_block_fast_allocator_init(allocator);
break;
case WMEM_ALLOCATOR_STRICT:
wmem_strict_allocator_init(allocator);
break;
default:
g_assert_not_reached();
/* This is necessary to squelch MSVC errors; is there
any way to tell it that g_assert_not_reached()
never returns? */
return NULL;
};
return allocator;
}
示例4: lbm_transport_frame_add
/*----------------------------------------------------------------------------*/
lbm_transport_frame_t * lbm_transport_frame_add(wmem_tree_t * list, guint8 type, guint32 frame, guint32 sqn, gboolean retransmission)
{
lbm_transport_frame_t * frame_entry = NULL;
/* Locate the frame. */
frame_entry = (lbm_transport_frame_t *) wmem_tree_lookup32(list, frame);
if (frame_entry != NULL)
{
return (frame_entry);
}
frame_entry = wmem_new(wmem_file_scope(), lbm_transport_frame_t);
frame_entry->frame = frame;
frame_entry->type = type;
frame_entry->sqn = sqn;
frame_entry->previous_frame = 0;
frame_entry->previous_type_frame = 0;
frame_entry->next_frame = 0;
frame_entry->next_type_frame = 0;
frame_entry->retransmission = retransmission;
frame_entry->sqn_gap = 0;
frame_entry->ooo_gap = 0;
frame_entry->duplicate = FALSE;
wmem_tree_insert32(list, frame, (void *) frame_entry);
return (frame_entry);
}
示例5: lbmtcp_transport_add
static lbmtcp_transport_t * lbmtcp_transport_add(const address * address1, guint16 port1, const address * address2, guint16 port2, guint32 frame)
{
lbmtcp_transport_t * entry;
conversation_t * conv = NULL;
conv = find_conversation(frame, address1, address2, PT_TCP, port1, port2, 0);
if (conv == NULL)
{
conv = conversation_new(frame, address1, address2, PT_TCP, port1, port2, 0);
}
entry = (lbmtcp_transport_t *) conversation_get_proto_data(conv, lbmpdm_tcp_protocol_handle);
if (entry != NULL)
{
return (entry);
}
entry = wmem_new(wmem_file_scope(), lbmtcp_transport_t);
copy_address_wmem(wmem_file_scope(), &(entry->addr1), address1);
entry->port1 = port1;
copy_address_wmem(wmem_file_scope(), &(entry->addr2), address2);
entry->port2 = port2;
lbmtcp_order_key(entry);
entry->channel = lbm_channel_assign(LBM_CHANNEL_TCP);
conversation_add_proto_data(conv, lbmpdm_tcp_protocol_handle, (void *) entry);
return (entry);
}
示例6: register_follow_stream
void register_follow_stream(const int proto_id, const char* tap_listener,
follow_conv_filter_func conv_filter, follow_index_filter_func index_filter, follow_address_filter_func address_filter,
follow_port_to_display_func port_to_display, tap_packet_cb tap_handler)
{
register_follow_t *follower;
DISSECTOR_ASSERT(tap_listener);
DISSECTOR_ASSERT(conv_filter);
DISSECTOR_ASSERT(index_filter);
DISSECTOR_ASSERT(address_filter);
DISSECTOR_ASSERT(port_to_display);
DISSECTOR_ASSERT(tap_handler);
follower = wmem_new(wmem_epan_scope(), register_follow_t);
follower->proto_id = proto_id;
follower->tap_listen_str = tap_listener;
follower->conv_filter = conv_filter;
follower->index_filter = index_filter;
follower->address_filter = address_filter;
follower->port_to_display = port_to_display;
follower->tap_handler = tap_handler;
if (registered_followers == NULL)
registered_followers = wmem_tree_new(wmem_epan_scope());
wmem_tree_insert_string(registered_followers, proto_get_protocol_short_name(find_protocol_by_id(proto_id)), follower, 0);
}
示例7: lbttcp_transport_sid_add
void lbttcp_transport_sid_add(const address * source_address, guint16 source_port, guint32 frame, guint32 session_id)
{
conversation_t * conv = NULL;
lbttcp_transport_conv_data_t * conv_data = NULL;
lbttcp_transport_t * transport = NULL;
conv = find_conversation(frame, source_address, &lbttcp_null_address, PT_TCP, source_port, 0, 0);
if (conv == NULL)
{
conv = conversation_new(frame, source_address, &lbttcp_null_address, PT_TCP, source_port, 0, 0);
}
conv_data = (lbttcp_transport_conv_data_t *) conversation_get_proto_data(conv, proto_lbttcp);
if (conv_data == NULL)
{
conv_data = wmem_new(wmem_file_scope(), lbttcp_transport_conv_data_t);
conv_data->frame_tree = wmem_tree_new(wmem_file_scope());
conv_data->session_tree = wmem_tree_new(wmem_file_scope());
conversation_add_proto_data(conv, proto_lbttcp, (void *) conv_data);
}
/* Lookup by frame */
transport = (lbttcp_transport_t *) wmem_tree_lookup32_le(conv_data->frame_tree, frame);
if (transport != NULL)
{
if (transport->session_id != session_id)
{
transport = NULL;
}
}
if (transport == NULL)
{
transport = lbttcp_transport_create(source_address, source_port, session_id);
wmem_tree_insert32(conv_data->session_tree, session_id, (void *) transport);
wmem_tree_insert32(conv_data->frame_tree, frame, (void *) transport);
}
}
示例8: lbttcp_transport_add
lbttcp_transport_t * lbttcp_transport_add(const address * source_address, guint16 source_port, guint32 session_id, guint32 frame)
{
lbttcp_transport_t * entry = NULL;
conversation_t * conv = NULL;
lbttcp_transport_conv_data_t * conv_data = NULL;
conv = find_conversation(frame, source_address, &lbttcp_null_address, PT_TCP, source_port, 0, 0);
if (conv == NULL)
{
conv = conversation_new(frame, source_address, &lbttcp_null_address, PT_TCP, source_port, 0, 0);
}
conv_data = (lbttcp_transport_conv_data_t *) conversation_get_proto_data(conv, proto_lbttcp);
if (conv_data == NULL)
{
conv_data = wmem_new(wmem_file_scope(), lbttcp_transport_conv_data_t);
conv_data->frame_tree = wmem_tree_new(wmem_file_scope());
conv_data->session_tree = wmem_tree_new(wmem_file_scope());
conversation_add_proto_data(conv, proto_lbttcp, (void *) conv_data);
}
entry = (lbttcp_transport_t *) wmem_tree_lookup32(conv_data->session_tree, session_id);
if (entry != NULL)
{
return (entry);
}
entry = lbttcp_transport_create(source_address, source_port, session_id);
wmem_tree_insert32(conv_data->session_tree, session_id, (void *) entry);
wmem_tree_insert32(conv_data->frame_tree, frame, (void *) entry);
return (entry);
}
示例9: conversation_new
/*
* Given two address/port pairs for a packet, create a new conversation
* to contain packets between those address/port pairs.
*
* The options field is used to specify whether the address 2 value
* and/or port 2 value are not given and any value is acceptable
* when searching for this conversation.
*/
conversation_t *
conversation_new(const guint32 setup_frame, const address *addr1, const address *addr2, const port_type ptype,
const guint32 port1, const guint32 port2, const guint options)
{
/*
DISSECTOR_ASSERT(!(options | CONVERSATION_TEMPLATE) || ((options | (NO_ADDR2 | NO_PORT2 | NO_PORT2_FORCE))) &&
"A conversation template may not be constructed without wildcard options");
*/
GHashTable* hashtable;
conversation_t *conversation=NULL;
conversation_key *new_key;
DPRINT(("creating conversation for frame #%d: %s:%d -> %s:%d (ptype=%d)",
setup_frame, address_to_str(wmem_packet_scope(), addr1), port1,
address_to_str(wmem_packet_scope(), addr2), port2, ptype));
if (options & NO_ADDR2) {
if (options & (NO_PORT2|NO_PORT2_FORCE)) {
hashtable = conversation_hashtable_no_addr2_or_port2;
} else {
hashtable = conversation_hashtable_no_addr2;
}
} else {
if (options & (NO_PORT2|NO_PORT2_FORCE)) {
hashtable = conversation_hashtable_no_port2;
} else {
hashtable = conversation_hashtable_exact;
}
}
new_key = wmem_new(wmem_file_scope(), struct conversation_key);
new_key->next = conversation_keys;
conversation_keys = new_key;
copy_address_wmem(wmem_file_scope(), &new_key->addr1, addr1);
copy_address_wmem(wmem_file_scope(), &new_key->addr2, addr2);
new_key->ptype = ptype;
new_key->port1 = port1;
new_key->port2 = port2;
conversation = wmem_new(wmem_file_scope(), conversation_t);
memset(conversation, 0, sizeof(conversation_t));
conversation->index = new_index;
conversation->setup_frame = conversation->last_frame = setup_frame;
conversation->data_list = NULL;
conversation->dissector_tree = wmem_tree_new(wmem_file_scope());
/* set the options and key pointer */
conversation->options = options;
conversation->key_ptr = new_key;
new_index++;
DINDENT();
conversation_insert_into_hashtable(hashtable, conversation);
DENDENT();
return conversation;
}
示例10: wmem_new
/* new pdu in this stream */
static stream_pdu_t *stream_new_pdu(stream_t *stream)
{
stream_pdu_t *pdu;
pdu = wmem_new(wmem_file_scope(), stream_pdu_t);
pdu -> fd_head = NULL;
pdu -> pdu_number = stream -> pdu_counter++;
pdu -> id = pdu_counter++;
return pdu;
}
示例11: add_oid
static oid_info_t* add_oid(const char* name, oid_kind_t kind, const oid_value_type_t* type, oid_key_t* key, guint oid_len, guint32 *subids) {
guint i = 0;
oid_info_t* c = &oid_root;
prepopulate_oids();
oid_len--;
do {
oid_info_t* n = (oid_info_t *)wmem_tree_lookup32(c->children,subids[i]);
if(n) {
if (i == oid_len) {
if (n->name) {
if (!g_str_equal(n->name,name)) {
D(2,("Renaming Oid from: %s -> %s, this means the same oid is registered more than once",n->name,name));
}
wmem_free(wmem_epan_scope(), n->name);
}
n->name = wmem_strdup(wmem_epan_scope(), name);
if (! n->value_type) {
n->value_type = type;
}
return n;
}
} else {
n = wmem_new(wmem_epan_scope(), oid_info_t);
n->subid = subids[i];
n->kind = kind;
n->children = wmem_tree_new(wmem_epan_scope());
n->value_hfid = -2;
n->key = key;
n->parent = c;
n->bits = NULL;
wmem_tree_insert32(c->children,n->subid,n);
if (i == oid_len) {
n->name = wmem_strdup(wmem_epan_scope(), name);
n->value_type = type;
n->kind = kind;
return n;
} else {
n->name = NULL;
n->value_type = NULL;
n->kind = OID_KIND_UNKNOWN;
}
}
c = n;
} while(++i);
g_assert_not_reached();
return NULL;
}
示例12: wmem_tree_new
wmem_tree_t *
wmem_tree_new(wmem_allocator_t *allocator)
{
wmem_tree_t *tree;
tree = wmem_new(allocator, wmem_tree_t);
tree->master = allocator;
tree->allocator = allocator;
tree->root = NULL;
return tree;
}
示例13: lbttcp_transport_create
static lbttcp_transport_t * lbttcp_transport_create(const address * source_address, guint16 source_port, guint32 session_id)
{
lbttcp_transport_t * transport = NULL;
transport = wmem_new(wmem_file_scope(), lbttcp_transport_t);
copy_address_wmem(wmem_file_scope(), &(transport->source_address), source_address);
transport->source_port = source_port;
transport->session_id = session_id;
transport->channel = lbm_channel_assign(LBM_CHANNEL_TRANSPORT_LBTTCP);
transport->next_client_id = 1;
transport->client_list = wmem_list_new(wmem_file_scope());
return (transport);
}
示例14: mark_pmproxy_exchange_complete
static void mark_pmproxy_exchange_complete(packet_info *pinfo) {
conversation_t *conversation;
pmproxy_conversation_info_t *pmproxy_conversation;
conversation = find_or_create_conversation(pinfo);
pmproxy_conversation = (pmproxy_conversation_info_t *)conversation_get_proto_data(conversation, proto_pmproxy);
if(pmproxy_conversation == NULL) {
pmproxy_conversation = wmem_new(wmem_file_scope(), pmproxy_conversation_info_t);
}
pmproxy_conversation->last_proxy_frame = pinfo->num;
conversation_add_proto_data(conversation, proto_pmproxy, pmproxy_conversation);
}
示例15: circuit_add_proto_data
void
circuit_add_proto_data(circuit_t *conv, int proto, void *proto_data)
{
circuit_proto_data *p1 = wmem_new(wmem_file_scope(), circuit_proto_data);
p1->proto = proto;
p1->proto_data = proto_data;
/* Add it to the list of items for this circuit. */
conv->data_list = g_slist_insert_sorted(conv->data_list, (gpointer *)p1,
p_compare);
}