📄 ftswap.c
字号:
SWAPINT32(pdu->sysUpTime); SWAPINT32(pdu->unix_secs); SWAPINT32(pdu->unix_nsecs); SWAPINT32(pdu->flow_sequence); for (--i; i >= 0; --i) { SWAPINT32(pdu->records[i].dFlows); SWAPINT32(pdu->records[i].dPkts); SWAPINT32(pdu->records[i].dOctets); SWAPINT32(pdu->records[i].First); SWAPINT32(pdu->records[i].Last); SWAPINT32(pdu->records[i].dst_prefix); SWAPINT16(pdu->records[i].dst_as); SWAPINT16(pdu->records[i].output); }} /* ftpdu_v8_4_swap *//* * function: ftpdu_v8_5_swap * * Swap bytes in a V8 agg method 5 PDU. cur is the current * byte order of the PDU **/void ftpdu_v8_5_swap(struct ftpdu_v8_5 *pdu, int cur){ int16 i; i = pdu->count;#if BYTE_ORDER == LITTLE_ENDIAN if (cur == BIG_ENDIAN) SWAPINT16(i);#endif /* BYTE_ORDER == LITTLE_ENDIAN */#if BYTE_ORDER == BIG_ENDIAN if (cur == LITTLE_ENDIAN) SWAPINT16(i);#endif /* BYTE_ORDER == LITTLE_ENDIAN */ SWAPINT16(pdu->version); SWAPINT16(pdu->count); SWAPINT32(pdu->sysUpTime); SWAPINT32(pdu->unix_secs); SWAPINT32(pdu->unix_nsecs); SWAPINT32(pdu->flow_sequence); for (--i; i >= 0; --i) { SWAPINT32(pdu->records[i].dFlows); SWAPINT32(pdu->records[i].dPkts); SWAPINT32(pdu->records[i].dOctets); SWAPINT32(pdu->records[i].First); SWAPINT32(pdu->records[i].Last); SWAPINT32(pdu->records[i].src_prefix); SWAPINT32(pdu->records[i].dst_prefix); SWAPINT16(pdu->records[i].src_as); SWAPINT16(pdu->records[i].dst_as); SWAPINT16(pdu->records[i].input); SWAPINT16(pdu->records[i].output); }} /* ftpdu_v8_5_swap *//* * function: ftpdu_v8_6_swap * * Swap bytes in a V8 agg method 6 PDU. cur is the current * byte order of the PDU **/void ftpdu_v8_6_swap(struct ftpdu_v8_6 *pdu, int cur){ int16 i; i = pdu->count;#if BYTE_ORDER == LITTLE_ENDIAN if (cur == BIG_ENDIAN) SWAPINT16(i);#endif /* BYTE_ORDER == LITTLE_ENDIAN */#if BYTE_ORDER == BIG_ENDIAN if (cur == LITTLE_ENDIAN) SWAPINT16(i);#endif /* BYTE_ORDER == LITTLE_ENDIAN */ SWAPINT16(pdu->version); SWAPINT16(pdu->count); SWAPINT32(pdu->sysUpTime); SWAPINT32(pdu->unix_secs); SWAPINT32(pdu->unix_nsecs); SWAPINT32(pdu->flow_sequence); for (--i; i >= 0; --i) { SWAPINT32(pdu->records[i].dstaddr); SWAPINT32(pdu->records[i].dPkts); SWAPINT32(pdu->records[i].dOctets); SWAPINT32(pdu->records[i].First); SWAPINT32(pdu->records[i].Last); SWAPINT16(pdu->records[i].output); SWAPINT32(pdu->records[i].extra_pkts); SWAPINT32(pdu->records[i].router_sc); }} /* ftpdu_v8_6_swap *//* * function: ftpdu_v8_7_swap * * Swap bytes in a V8 agg method 7 PDU. cur is the current * byte order of the PDU **/void ftpdu_v8_7_swap(struct ftpdu_v8_7 *pdu, int cur){ int16 i; i = pdu->count;#if BYTE_ORDER == LITTLE_ENDIAN if (cur == BIG_ENDIAN) SWAPINT16(i);#endif /* BYTE_ORDER == LITTLE_ENDIAN */#if BYTE_ORDER == BIG_ENDIAN if (cur == LITTLE_ENDIAN) SWAPINT16(i);#endif /* BYTE_ORDER == LITTLE_ENDIAN */ SWAPINT16(pdu->version); SWAPINT16(pdu->count); SWAPINT32(pdu->sysUpTime); SWAPINT32(pdu->unix_secs); SWAPINT32(pdu->unix_nsecs); SWAPINT32(pdu->flow_sequence); for (--i; i >= 0; --i) { SWAPINT32(pdu->records[i].dstaddr); SWAPINT32(pdu->records[i].srcaddr); SWAPINT32(pdu->records[i].dPkts); SWAPINT32(pdu->records[i].dOctets); SWAPINT32(pdu->records[i].First); SWAPINT32(pdu->records[i].Last); SWAPINT16(pdu->records[i].input); SWAPINT16(pdu->records[i].output); SWAPINT32(pdu->records[i].extra_pkts); SWAPINT32(pdu->records[i].router_sc); }} /* ftpdu_v8_7_swap *//* * function: ftpdu_v8_8_swap * * Swap bytes in a V8 agg method 7 PDU. cur is the current * byte order of the PDU **/void ftpdu_v8_8_swap(struct ftpdu_v8_8 *pdu, int cur){ int16 i; i = pdu->count;#if BYTE_ORDER == LITTLE_ENDIAN if (cur == BIG_ENDIAN) SWAPINT16(i);#endif /* BYTE_ORDER == LITTLE_ENDIAN */#if BYTE_ORDER == BIG_ENDIAN if (cur == LITTLE_ENDIAN) SWAPINT16(i);#endif /* BYTE_ORDER == LITTLE_ENDIAN */ SWAPINT16(pdu->version); SWAPINT16(pdu->count); SWAPINT32(pdu->sysUpTime); SWAPINT32(pdu->unix_secs); SWAPINT32(pdu->unix_nsecs); SWAPINT32(pdu->flow_sequence); for (--i; i >= 0; --i) { SWAPINT32(pdu->records[i].dstaddr); SWAPINT32(pdu->records[i].srcaddr); SWAPINT16(pdu->records[i].dstport); SWAPINT16(pdu->records[i].srcport); SWAPINT32(pdu->records[i].dPkts); SWAPINT32(pdu->records[i].dOctets); SWAPINT32(pdu->records[i].First); SWAPINT32(pdu->records[i].Last); SWAPINT16(pdu->records[i].input); SWAPINT16(pdu->records[i].output); SWAPINT32(pdu->records[i].extra_pkts); SWAPINT32(pdu->records[i].router_sc); }} /* ftpdu_v8_8_swap *//* * function: ftpdu_v8_9_swap * * Swap bytes in a V8 agg method 9 PDU. cur is the current * byte order of the PDU **/void ftpdu_v8_9_swap(struct ftpdu_v8_9 *pdu, int cur){ int16 i; i = pdu->count;#if BYTE_ORDER == LITTLE_ENDIAN if (cur == BIG_ENDIAN) SWAPINT16(i);#endif /* BYTE_ORDER == LITTLE_ENDIAN */#if BYTE_ORDER == BIG_ENDIAN if (cur == LITTLE_ENDIAN) SWAPINT16(i);#endif /* BYTE_ORDER == LITTLE_ENDIAN */ SWAPINT16(pdu->version); SWAPINT16(pdu->count); SWAPINT32(pdu->sysUpTime); SWAPINT32(pdu->unix_secs); SWAPINT32(pdu->unix_nsecs); SWAPINT32(pdu->flow_sequence); for (--i; i >= 0; --i) { SWAPINT32(pdu->records[i].dFlows); SWAPINT32(pdu->records[i].dPkts); SWAPINT32(pdu->records[i].dOctets); SWAPINT32(pdu->records[i].First); SWAPINT32(pdu->records[i].Last); SWAPINT16(pdu->records[i].src_as); SWAPINT16(pdu->records[i].dst_as); SWAPINT16(pdu->records[i].input); SWAPINT16(pdu->records[i].output); }} /* ftpdu_v8_9_swap *//* * function: ftpdu_v8_10_swap * * Swap bytes in a V8 agg method 10 PDU. cur is the current * byte order of the PDU **/void ftpdu_v8_10_swap(struct ftpdu_v8_10 *pdu, int cur){ int16 i; i = pdu->count;#if BYTE_ORDER == LITTLE_ENDIAN if (cur == BIG_ENDIAN) SWAPINT16(i);#endif /* BYTE_ORDER == LITTLE_ENDIAN */#if BYTE_ORDER == BIG_ENDIAN if (cur == LITTLE_ENDIAN) SWAPINT16(i);#endif /* BYTE_ORDER == LITTLE_ENDIAN */ SWAPINT16(pdu->version); SWAPINT16(pdu->count); SWAPINT32(pdu->sysUpTime); SWAPINT32(pdu->unix_secs); SWAPINT32(pdu->unix_nsecs); SWAPINT32(pdu->flow_sequence); for (--i; i >= 0; --i) { SWAPINT32(pdu->records[i].dFlows); SWAPINT32(pdu->records[i].dPkts); SWAPINT32(pdu->records[i].dOctets); SWAPINT32(pdu->records[i].First); SWAPINT32(pdu->records[i].Last); SWAPINT32(pdu->records[i].srcport); SWAPINT32(pdu->records[i].dstport); SWAPINT16(pdu->records[i].input); SWAPINT16(pdu->records[i].output); }} /* ftpdu_v8_10_swap *//* * function: ftpdu_v8_11_swap * * Swap bytes in a V8 agg method 11 PDU. cur is the current * byte order of the PDU **/void ftpdu_v8_11_swap(struct ftpdu_v8_11 *pdu, int cur){ int16 i; i = pdu->count;#if BYTE_ORDER == LITTLE_ENDIAN if (cur == BIG_ENDIAN) SWAPINT16(i);#endif /* BYTE_ORDER == LITTLE_ENDIAN */#if BYTE_ORDER == BIG_ENDIAN if (cur == LITTLE_ENDIAN) SWAPINT16(i);#endif /* BYTE_ORDER == LITTLE_ENDIAN */ SWAPINT16(pdu->version); SWAPINT16(pdu->count); SWAPINT32(pdu->sysUpTime); SWAPINT32(pdu->unix_secs); SWAPINT32(pdu->unix_nsecs); SWAPINT32(pdu->flow_sequence); for (--i; i >= 0; --i) { SWAPINT32(pdu->records[i].dFlows); SWAPINT32(pdu->records[i].dPkts); SWAPINT32(pdu->records[i].dOctets); SWAPINT32(pdu->records[i].First); SWAPINT32(pdu->records[i].Last); SWAPINT32(pdu->records[i].src_prefix); SWAPINT16(pdu->records[i].src_as); SWAPINT16(pdu->records[i].input); }} /* ftpdu_v8_11_swap *//* * function: ftpdu_v8_12_swap * * Swap bytes in a V8 agg method 12 PDU. cur is the current * byte order of the PDU **/void ftpdu_v8_12_swap(struct ftpdu_v8_12 *pdu, int cur){ int16 i; i = pdu->count;#if BYTE_ORDER == LITTLE_ENDIAN if (cur == BIG_ENDIAN) SWAPINT16(i);#endif /* BYTE_ORDER == LITTLE_ENDIAN */#if BYTE_ORDER == BIG_ENDIAN if (cur == LITTLE_ENDIAN) SWAPINT16(i);#endif /* BYTE_ORDER == LITTLE_ENDIAN */ SWAPINT16(pdu->version); SWAPINT16(pdu->count); SWAPINT32(pdu->sysUpTime); SWAPINT32(pdu->unix_secs); SWAPINT32(pdu->unix_nsecs); SWAPINT32(pdu->flow_sequence); for (--i; i >= 0; --i) { SWAPINT32(pdu->records[i].dFlows); SWAPINT32(pdu->records[i].dPkts); SWAPINT32(pdu->records[i].dOctets); SWAPINT32(pdu->records[i].First); SWAPINT32(pdu->records[i].Last); SWAPINT32(pdu->records[i].dst_prefix); SWAPINT16(pdu->records[i].dst_as); SWAPINT16(pdu->records[i].output); }} /* ftpdu_v8_12_swap *//* * function: ftpdu_v8_13_swap * * Swap bytes in a V8 agg method 13 PDU. cur is the current * byte order of the PDU **/void ftpdu_v8_13_swap(struct ftpdu_v8_13 *pdu, int cur){ int16 i; i = pdu->count;#if BYTE_ORDER == LITTLE_ENDIAN if (cur == BIG_ENDIAN) SWAPINT16(i);#endif /* BYTE_ORDER == LITTLE_ENDIAN */#if BYTE_ORDER == BIG_ENDIAN if (cur == LITTLE_ENDIAN) SWAPINT16(i);#endif /* BYTE_ORDER == LITTLE_ENDIAN */ SWAPINT16(pdu->version); SWAPINT16(pdu->count); SWAPINT32(pdu->sysUpTime); SWAPINT32(pdu->unix_secs); SWAPINT32(pdu->unix_nsecs); SWAPINT32(pdu->flow_sequence); for (--i; i >= 0; --i) { SWAPINT32(pdu->records[i].dFlows); SWAPINT32(pdu->records[i].dPkts); SWAPINT32(pdu->records[i].dOctets); SWAPINT32(pdu->records[i].First); SWAPINT32(pdu->records[i].Last); SWAPINT32(pdu->records[i].src_prefix); SWAPINT32(pdu->records[i].dst_prefix); SWAPINT16(pdu->records[i].src_as); SWAPINT16(pdu->records[i].dst_as); SWAPINT16(pdu->records[i].input); SWAPINT16(pdu->records[i].output); }} /* ftpdu_v8_13_swap *//* * function: ftpdu_v8_14_swap * * Swap bytes in a V8 agg method 14 PDU. cur is the current * byte order of the PDU **/void ftpdu_v8_14_swap(struct ftpdu_v8_14 *pdu, int cur){ int16 i; i = pdu->count;#if BYTE_ORDER == LITTLE_ENDIAN if (cur == BIG_ENDIAN) SWAPINT16(i);#endif /* BYTE_ORDER == LITTLE_ENDIAN */#if BYTE_ORDER == BIG_ENDIAN if (cur == LITTLE_ENDIAN) SWAPINT16(i);#endif /* BYTE_ORDER == LITTLE_ENDIAN */ SWAPINT16(pdu->version); SWAPINT16(pdu->count); SWAPINT32(pdu->sysUpTime); SWAPINT32(pdu->unix_secs); SWAPINT32(pdu->unix_nsecs); SWAPINT32(pdu->flow_sequence); for (--i; i >= 0; --i) { SWAPINT32(pdu->records[i].dFlows); SWAPINT32(pdu->records[i].dPkts); SWAPINT32(pdu->records[i].dOctets); SWAPINT32(pdu->records[i].First); SWAPINT32(pdu->records[i].Last); SWAPINT32(pdu->records[i].src_prefix); SWAPINT32(pdu->records[i].dst_prefix); SWAPINT16(pdu->records[i].srcport); SWAPINT16(pdu->records[i].dstport); SWAPINT16(pdu->records[i].input); SWAPINT16(pdu->records[i].output); }} /* ftpdu_v8_14_swap *//* * function: fts3rec_swap_v1 * * Swap bytes in a fts3rec_v1 struct **/void fts3rec_swap_v1(struct fts3rec_v1 *rec){ SWAPINT32(rec->unix_secs); SWAPINT32(rec->unix_nsecs); SWAPINT32(rec->sysUpTime); SWAPINT32(rec->exaddr); SWAPINT32(rec->srcaddr); SWAPINT32(rec->dstaddr); SWAPINT32(rec->nexthop); SWAPINT16(rec->input); SWAPINT16(rec->output); SWAPINT32(rec->dPkts); SWAPINT32(rec->dOctets); SWAPINT32(rec->First); SWAPINT32(rec->Last);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -