Changeset 979a84f4
- Timestamp:
- 09/20/11 15:50:53 (9 years ago)
- Branches:
- 4.0.1-hotfixes, cachetimestamps, develop, dpdk-ndag, etsilive, getfragoff, help, libtrace4, master, ndag_format, pfring, rc-4.0.1, rc-4.0.2, rc-4.0.3, rc-4.0.4, ringdecrementfix, ringperformance, ringtimestampfixes
- Children:
- 50c5053
- Parents:
- c0ccccd
- Location:
- lib
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/libtrace.h.in
rc0506ea r979a84f4 420 420 buf_control_t buf_control; /**< Describes memory ownership */ 421 421 int capture_length; /**< Cached capture length */ 422 int wire_length; /**< Cached wire length */ 422 423 int payload_length; /**< Cached payload length */ 423 424 void *l2_header; /**< Cached link header */ -
lib/protocols_l2.c
ree58d0d r979a84f4 381 381 case TRACE_TYPE_METADATA: 382 382 case TRACE_TYPE_NONDATA: 383 ((libtrace_packet_t*)packet)->link_type = *linktype;384 383 ((libtrace_packet_t*)packet)->l2_header = meta; 385 384 ((libtrace_packet_t*)packet)->l2_remaining = *remaining; … … 414 413 case TRACE_TYPE_METADATA: 415 414 case TRACE_TYPE_NONDATA: 416 ((libtrace_packet_t*)packet)->link_type = *linktype;417 415 ((libtrace_packet_t*)packet)->l2_header = meta; 418 416 ((libtrace_packet_t*)packet)->l2_remaining = *remaining; -
lib/trace.c
rc0506ea r979a84f4 1041 1041 */ 1042 1042 DLLEXPORT size_t trace_get_wire_length(const libtrace_packet_t *packet){ 1043 if (packet->trace->format->get_wire_length) { 1044 return packet->trace->format->get_wire_length(packet); 1045 } 1046 return ~0U; 1043 1044 if (packet->wire_length == -1) { 1045 if (!packet->trace->format->get_wire_length) 1046 return ~0U; 1047 ((libtrace_packet_t *)packet)->wire_length = 1048 packet->trace->format->get_wire_length(packet); 1049 } 1050 1051 assert(packet->wire_length < LIBTRACE_PACKET_BUFSIZE); 1052 return packet->wire_length; 1047 1053 1048 1054 } … … 1068 1074 */ 1069 1075 DLLEXPORT libtrace_linktype_t trace_get_link_type(const libtrace_packet_t *packet ) { 1070 if (packet->trace->format->get_link_type) { 1071 return packet->trace->format->get_link_type(packet); 1072 } 1073 return (libtrace_linktype_t)-1; 1076 1077 if (packet->link_type == 0) { 1078 if (!packet->trace->format->get_link_type) 1079 return (libtrace_linktype_t)-1; 1080 ((libtrace_packet_t *)packet)->link_type = 1081 packet->trace->format->get_link_type(packet); 1082 } 1083 1084 return packet->link_type; 1074 1085 } 1075 1086 … … 1834 1845 packet->transport_proto = 0; 1835 1846 packet->capture_length = -1; 1847 packet->wire_length = -1; 1836 1848 packet->payload_length = -1; 1837 1849 packet->l2_remaining = 0;
Note: See TracChangeset
for help on using the changeset viewer.