/* * Set the port 2 value in a key. Remove the original from table, * update the options and port values, insert the updated key. */ void conversation_set_port2(conversation_t *conv, const guint32 port) { DISSECTOR_ASSERT_HINT(!(conv->options & CONVERSATION_TEMPLATE), "Use the conversation_create_from_template function when the CONVERSATION_TEMPLATE bit is set in the options mask"); /* * If the port 2 value is not wildcarded, don't set it. */ if ((!(conv->options & NO_PORT2)) || (conv->options & NO_PORT2_FORCE)) return; if (conv->options & NO_ADDR2) { conversation_remove_from_hashtable(conversation_hashtable_no_addr2_or_port2, conv); } else { conversation_remove_from_hashtable(conversation_hashtable_no_port2, conv); } conv->options &= ~NO_PORT2; conv->key_ptr->port2 = port; if (conv->options & NO_ADDR2) { conversation_insert_into_hashtable(conversation_hashtable_no_addr2, conv); } else { conversation_insert_into_hashtable(conversation_hashtable_exact, conv); } }
/* * Set the address 2 value in a key. Remove the original from * table, update the options and port values, insert the updated key. */ void conversation_set_addr2(conversation_t *conv, const address *addr) { DISSECTOR_ASSERT_HINT(!(conv->options & CONVERSATION_TEMPLATE), "Use the conversation_create_from_template function when the CONVERSATION_TEMPLATE bit is set in the options mask"); /* * If the address 2 value is not wildcarded, don't set it. */ if (!(conv->options & NO_ADDR2)) return; if (conv->options & NO_PORT2) { conversation_remove_from_hashtable(conversation_hashtable_no_addr2_or_port2, conv); } else { conversation_remove_from_hashtable(conversation_hashtable_no_port2, conv); } conv->options &= ~NO_ADDR2; SE_COPY_ADDRESS(&conv->key_ptr->addr2, addr); if (conv->options & NO_PORT2) { conversation_insert_into_hashtable(conversation_hashtable_no_port2, conv); } else { conversation_insert_into_hashtable(conversation_hashtable_exact, conv); } }
/* * Set the address 2 value in a key. Remove the original from * table, update the options and port values, insert the updated key. */ void conversation_set_addr2(conversation_t *conv, const address *addr) { char* addr_str; DISSECTOR_ASSERT_HINT(!(conv->options & CONVERSATION_TEMPLATE), "Use the conversation_create_from_template function when the CONVERSATION_TEMPLATE bit is set in the options mask"); addr_str = address_to_str(NULL, addr); DPRINT(("called for addr=%s", addr_str)); wmem_free(NULL, addr_str); /* * If the address 2 value is not wildcarded, don't set it. */ if (!(conv->options & NO_ADDR2)) return; DINDENT(); if (conv->options & NO_PORT2) { conversation_remove_from_hashtable(conversation_hashtable_no_addr2_or_port2, conv); } else { conversation_remove_from_hashtable(conversation_hashtable_no_port2, conv); } conv->options &= ~NO_ADDR2; copy_address_wmem(wmem_file_scope(), &conv->key_ptr->addr2, addr); if (conv->options & NO_PORT2) { conversation_insert_into_hashtable(conversation_hashtable_no_port2, conv); } else { conversation_insert_into_hashtable(conversation_hashtable_exact, conv); } DENDENT(); }