コード例 #1
0
ファイル: packet-fast.c プロジェクト: sm1ly/fast-wireshark
/*! \brief Hook function that Wireshark calls to dissect a packet.
 *  \param tvb the actual packet data
 *  \param pinfo metadata for this packet
 *  \param tree where we put the data we want wireshark to print
 */
void dissect_fast(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree)
{  
  frame_data* frameData;
  PacketData* packetData;
  frameData = pinfo->fd;
 
  if(reparse_templates){
    GNode* templates;
    templates = parse_templates_xml (config_template_xml_path);
    add_templates(templates);
    reparse_templates = FALSE;
  } 
  
  /* fill in protocol column */
  if (check_col(pinfo->cinfo, COL_PROTOCOL)) {
    col_set_str(pinfo->cinfo, COL_PROTOCOL, "FAST");
  }

  /* clear anything out of the info column */
  if (check_col(pinfo->cinfo, COL_INFO)) {
    col_clear(pinfo->cinfo, COL_INFO);
  }

  /* Only do dissection if we are asked */
  if (tree) {
    proto_item* ti;
    proto_tree* fast_tree;

    /* Create display subtree. */
    ti = proto_tree_add_item(tree, proto_fast, tvb, 0, -1, ENC_NA);
    fast_tree = proto_item_add_subtree(ti, ett_fast);
    
    if(!dissected_packets_table) {
      dissected_packets_table = g_hash_table_new(&g_int_hash, &g_int_equal);
      /* If we fail to make the table bail */
      if(!dissected_packets_table) { BAILOUT(;,"Packet lookup table not created."); }
コード例 #2
0
ファイル: gstmodule.c プロジェクト: thiblahute/gst-python
static int
_pygst_element_init (gpointer gclass, PyTypeObject * pyclass)
{
  PyObject *templates, *metadata;

  GST_DEBUG ("_pygst_element_init for gclass %p", gclass);
  templates = PyDict_GetItemString (pyclass->tp_dict, "__gsttemplates__");
  if (templates) {
    if (add_templates (gclass, templates) != 0)
      return -1;
  } else {
    PyErr_Clear ();
  }
  metadata = PyDict_GetItemString (pyclass->tp_dict, "__gstmetadata__");
  if (metadata) {
    if (_pygst_element_set_metadata (gclass, metadata) != 0)
      return -1;
    PyDict_DelItemString (pyclass->tp_dict, "__gstmetadata__");
  } else {
    PyErr_Clear ();
  }

  return 0;
}