コード例 #1
0
static int httpPlugin_export(void *pluginData, V9TemplateId *theTemplate,
			     int direction /* 0 = src->dst, 1 = dst->src */,
			     HashBucket *bkt, char *outBuffer,
			     u_int* outBufferBegin, u_int* outBufferMax) {
  int i;

  for(i=0; httpPlugin_template[i].templateId != 0; i++) {
    if(theTemplate->templateId == httpPlugin_template[i].templateId) {
      if((*outBufferBegin)+httpPlugin_template[i].templateLen > (*outBufferMax))
	return(-2); /* Too long */

      if(pluginData) {
	struct plugin_info *info = (struct plugin_info *)pluginData;

	switch(httpPlugin_template[i].templateId) {
	case BASE_ID:
	  memcpy(&outBuffer[*outBufferBegin], info->http_url, URL_MAX_LEN);
	  // traceEvent(TRACE_INFO, "==> URL='%s'", info->http_url);
	  break;
	case BASE_ID+1:
	  copyInt16(info->ret_code, outBuffer, outBufferBegin, outBufferMax);
	  // traceEvent(TRACE_INFO, "==> RetCode='%d'", info->ret_code);
	  break;
	default:
	  return(-1); /* Not handled */
	}

	return(0);
      }
    }
  }

  return(-1); /* Not handled */
}
コード例 #2
0
static int sipPlugin_export(void *pluginData, V9TemplateId *theTemplate, 
			    int direction /* 0 = src->dst, 1 = dst->src */,
			    HashBucket *bkt, char *outBuffer,
			    u_int* outBufferBegin, u_int* outBufferMax) {
  int i;

  for(i=0; sipPlugin_template[i].templateId != 0; i++) {
    if(theTemplate->templateId == sipPlugin_template[i].templateId) {
      if((*outBufferBegin)+sipPlugin_template[i].templateLen > (*outBufferMax))
	return(-2); /* Too long */

      if(pluginData) {
	struct plugin_info *info = (struct plugin_info *)pluginData;

	switch(sipPlugin_template[i].templateId) {
	case BASE_ID:
	  copyLen((u_char*)info->sip_call_id, sipPlugin_template[i].templateLen,
		  outBuffer, outBufferBegin, outBufferMax);
	  if(traceMode) traceEvent(TRACE_INFO, "sip_call_id: %s", info->sip_call_id);
	  break;
	case BASE_ID+1:
	  copyLen((u_char*)info->sip_calling_party, sipPlugin_template[i].templateLen,
		  outBuffer, outBufferBegin, outBufferMax);
	  if(traceMode) traceEvent(TRACE_INFO, "sip_calling_party: %s", info->sip_calling_party);
	  break;
	case BASE_ID+2:
	  copyLen((u_char*)info->sip_called_party, sipPlugin_template[i].templateLen,
		  outBuffer, outBufferBegin, outBufferMax);
	  if(traceMode) traceEvent(TRACE_INFO, "sip_called_party: %s", info->sip_called_party);
	  break;
	case BASE_ID+3:
	  copyLen((u_char*)info->rtp_codecs, sipPlugin_template[i].templateLen,
		  outBuffer, outBufferBegin, outBufferMax);
	  if(traceMode) traceEvent(TRACE_INFO, "rtp_codecs: %s", info->rtp_codecs);
	  break;
	case BASE_ID+4:
	  copyInt32(msTimeDiff(info->sip_invite_time, initialSniffTime), 
		    outBuffer, outBufferBegin, outBufferMax);
	  if(traceMode) traceEvent(TRACE_INFO, "sip_invite_time: %u",
		     msTimeDiff(info->sip_invite_time, initialSniffTime));
	  break;
	case BASE_ID+5:
	  copyInt32(msTimeDiff(info->sip_trying_time, initialSniffTime), 
		    outBuffer, outBufferBegin, outBufferMax);
	  if(traceMode) traceEvent(TRACE_INFO, "sip_trying_time: %u",
		     msTimeDiff(info->sip_trying_time, initialSniffTime));
	  break;
	case BASE_ID+6:
	  copyInt32(msTimeDiff(info->sip_ringing_time, initialSniffTime),
		    outBuffer, outBufferBegin, outBufferMax);
	  if(traceMode) traceEvent(TRACE_INFO, "sip_ringing_time: %u", 
		     msTimeDiff(info->sip_ringing_time, initialSniffTime));
	  break;
	case BASE_ID+7:
	  copyInt32(msTimeDiff(info->sip_ok_time, initialSniffTime), 
		    outBuffer, outBufferBegin, outBufferMax);
	  if(traceMode) traceEvent(TRACE_INFO, "sip_ok_time: %u", 
		     msTimeDiff(info->sip_ok_time, initialSniffTime));
	  break;
	case BASE_ID+8:
	  copyInt32(msTimeDiff(info->sip_ack_time, initialSniffTime), 
		    outBuffer, outBufferBegin, outBufferMax);
	  if(traceMode) traceEvent(TRACE_INFO, "sip_ack_time: %u", 
		     msTimeDiff(info->sip_ack_time, initialSniffTime));
	  break;
	case BASE_ID+9:
	  copyInt16(direction == 0 ? info->rtp_src_port :
		    info->rtp_dst_port, outBuffer, outBufferBegin, outBufferMax);
	  if(traceMode) traceEvent(TRACE_INFO, "rtp_src_port: %d", info->rtp_src_port);
	  break;
	case BASE_ID+10:
	  copyInt16(direction == 0 ? info->rtp_dst_port : info->rtp_src_port,
		    outBuffer, outBufferBegin, outBufferMax);
	  if(traceMode) traceEvent(TRACE_INFO, "rtp_dst_port: %d", info->rtp_dst_port); 
	  break;
	default:
	  return(-1); /* Not handled */	  
	}
	
	return(0);
      }
    }
  }

  return(-1); /* Not handled */
}