コード例 #1
0
ファイル: frame_data.c プロジェクト: dot-Sean/wireshark-http2
gint
frame_data_compare(const struct epan_session *epan, const frame_data *fdata1, const frame_data *fdata2, int field)
{
  switch (field) {
  case COL_NUMBER:
    return COMPARE_FRAME_NUM();

  case COL_CLS_TIME:
    switch (timestamp_get_type()) {
    case TS_ABSOLUTE:
    case TS_ABSOLUTE_WITH_YMD:
    case TS_ABSOLUTE_WITH_YDOY:
    case TS_UTC:
    case TS_UTC_WITH_YMD:
    case TS_UTC_WITH_YDOY:
    case TS_EPOCH:
      return COMPARE_TS(abs_ts);

    case TS_RELATIVE:
      return frame_data_time_delta_rel_compare(epan, fdata1, fdata2);

    case TS_DELTA:
      return frame_data_time_delta_compare(epan, fdata1, fdata2);

    case TS_DELTA_DIS:
      return frame_data_time_delta_dis_compare(epan, fdata1, fdata2);

    case TS_NOT_SET:
      return 0;
    }
    return 0;

  case COL_ABS_TIME:
  case COL_ABS_YMD_TIME:
  case COL_ABS_YDOY_TIME:
  case COL_UTC_TIME:
  case COL_UTC_YMD_TIME:
  case COL_UTC_YDOY_TIME:
    return COMPARE_TS(abs_ts);

  case COL_REL_TIME:
    return frame_data_time_delta_rel_compare(epan, fdata1, fdata2);

  case COL_DELTA_TIME:
    return frame_data_time_delta_compare(epan, fdata1, fdata2);

  case COL_DELTA_TIME_DIS:
    return frame_data_time_delta_dis_compare(epan, fdata1, fdata2);

  case COL_PACKET_LENGTH:
    return COMPARE_NUM(pkt_len);

  case COL_CUMULATIVE_BYTES:
    return COMPARE_NUM(cum_bytes);

  }
  g_return_val_if_reached(0);
}
コード例 #2
0
ファイル: IPFilterDlg.cpp プロジェクト: LjApps/eMule-VeryCD
int __cdecl CompareIPFilterItems(const void* lParam1, const void* lParam2)
{
#define COMPARE_NUM( a, b ) ((a) < (b))			\
							  ? -1				\
							  : ( ((b) < (a))	\
									? 1			\
									: 0			\
								)

	int iResult;

	if (_lParamSort == IPFILTER_COL_START)
	{
		iResult = COMPARE_NUM((*((const SIPFilter**)lParam1))->start, (*((const SIPFilter**)lParam2))->start);
	}
	else if (_lParamSort == IPFILTER_COL_END)
	{
		iResult = COMPARE_NUM((*((const SIPFilter**)lParam1))->end, (*((const SIPFilter**)lParam2))->end);
	}
	else if (_lParamSort == IPFILTER_COL_LEVEL)
	{
		iResult = COMPARE_NUM((*((const SIPFilter**)lParam1))->level, (*((const SIPFilter**)lParam2))->level);
	}
	else if (_lParamSort == IPFILTER_COL_HITS)
	{
		iResult = COMPARE_NUM((*((const SIPFilter**)lParam1))->hits, (*((const SIPFilter**)lParam2))->hits);
	}
	else if (_lParamSort == IPFILTER_COL_DESC)
	{
		iResult = stricmp/*CompareLocaleStringNoCase*/((*((const SIPFilter**)lParam1))->desc, (*((const SIPFilter**)lParam2))->desc);
	}
	else
	{
		ASSERT(0);
		iResult = 0;
	}

#undef COMPARE_NUM

	if (_aColumns[_lParamSort].eSortOrder == DESCENDING)
		return -iResult;
	else
		return iResult;
}