- Timestamp:
- 02/23/06 13:14:32 (16 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:
- 8ea5b38
- Parents:
- aa62105
- Location:
- lib
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/format_erf.c
raa62105 r52f8fc2 408 408 dag_record_size)) == -1) { 409 409 trace_set_err(errno,"read(%s)", 410 packet->trace->uridata);410 libtrace->uridata); 411 411 return -1; 412 412 } … … 428 428 buffer2, 429 429 size)) != size) { 430 trace_set_err(errno, "read(%s)", packet->trace->uridata);430 trace_set_err(errno, "read(%s)", libtrace->uridata); 431 431 return -1; 432 432 } … … 474 474 void *buffer = 0; 475 475 476 packet->trace = libtrace;477 478 476 if (packet->buf_control == TRACE_CTRL_EXTERNAL || !packet->buffer) { 479 477 packet->buf_control = TRACE_CTRL_PACKET; … … 591 589 } 592 590 593 if ( packet->trace->format == &erf591 if (libtrace->format == &erf 594 592 #if HAVE_DAG 595 || packet->trace->format == &dag593 || libtrace->format == &dag 596 594 #endif 597 595 ) { … … 678 676 } 679 677 680 static int rtclient_get_fd(const struct libtrace_packet_t *packet) {681 return packet->trace->format_data->input.fd;682 } 683 684 static int erf_get_fd(const struct libtrace_packet_t *packet) {685 return packet->trace->format_data->input.fd;678 static int rtclient_get_fd(const libtrace_t *trace) { 679 return trace->format_data->input.fd; 680 } 681 682 static int erf_get_fd(const libtrace_t *trace) { 683 return trace->format_data->input.fd; 686 684 } 687 685 … … 692 690 int data; 693 691 694 if ( packet->trace->format->get_fd) {695 dag_fd = packet->trace->format->get_fd(packet);692 if (trace->format->get_fd) { 693 dag_fd = trace->format->get_fd(packet); 696 694 } else { 697 695 dag_fd = 0; -
lib/format_helper.c
rfe76c55 r52f8fc2 52 52 int data; 53 53 54 if ( packet->trace->format->get_fd) {55 event.fd = packet->trace->format->get_fd(packet);54 if (trace->format->get_fd) { 55 event.fd = trace->format->get_fd(packet); 56 56 } else { 57 57 event.fd = 0; -
lib/format_legacy.c
rc1db742 r52f8fc2 166 166 packet->header = packet->buffer; 167 167 packet->payload = (void*)((char*)packet->buffer + 168 packet->trace->format->get_framing_length(packet));168 libtrace->format->get_framing_length(packet)); 169 169 170 170 return 64; -
lib/format_pcap.c
rf0d19d4 r52f8fc2 299 299 fflush((FILE *)OUTPUT.trace.dump); 300 300 } 301 if ( packet->trace->format == &pcap ||302 packet->trace->format == &pcapint) {301 if (libtrace->format == &pcap || 302 libtrace->format == &pcapint) { 303 303 304 304 pcap_dump((u_char*)OUTPUT.trace.dump,(struct pcap_pkthdr *)packet->header,packet->payload); … … 428 428 } 429 429 430 static int pcap_get_fd(const struct libtrace_packet_t *packet) {431 return pcap_fileno( packet->trace->format_data->input.pcap);430 static int pcap_get_fd(const libtrace_t *trace) { 431 return pcap_fileno(trace->format_data->input.pcap); 432 432 } 433 433 -
lib/format_rt.c
rc2d5f23 r52f8fc2 389 389 rt_data_t data_hdr; 390 390 void *buffer = 0; 391 392 packet->trace = libtrace;393 391 394 392 if (packet->buf_control == TRACE_CTRL_EXTERNAL || !packet->buffer) { … … 507 505 } 508 506 509 static int rt_get_fd(const struct libtrace_ packet_t *packet) {510 return packet->trace->format_data->input_fd;507 static int rt_get_fd(const struct libtrace_t *trace) { 508 return trace->format_data->input_fd; 511 509 } 512 510 … … 554 552 NULL, /* get_framing_length */ 555 553 NULL, /* set_capture_length */ 556 rt_get_fd, /* get_fd */554 rt_get_fd, /* get_fd */ 557 555 trace_event_device, /* trace_event */ 558 556 rt_help /* help */ -
lib/format_wag.c
rf0d19d4 r52f8fc2 407 407 } 408 408 409 static int wag_get_fd(const struct libtrace_packet_t *packet) {410 return packet->trace->format_data->input.fd;409 static int wag_get_fd(const libtrace_t *trace) { 410 return trace->format_data->input.fd; 411 411 } 412 412 -
lib/libtrace.h
r91c9552 r52f8fc2 718 718 * @author Perry Lorier 719 719 * @note Due to this being a header capture, or anonymisation, this may not 720 * be the same size as the original packet. See get_wire_length() for the original721 * size of the packet.720 * be the same size as the original packet. See get_wire_length() for the 721 * original size of the packet. 722 722 * @note This can (and often is) different for different packets in a trace! 723 * @par 724 * This is sometimes called the "snaplen". 723 * @note This is sometimes called the "snaplen". 724 * @note The return size refers to the network-level payload of the packet and 725 * does not include any capture headers. For example, an Ethernet packet with 726 * an empty TCP packet will return sizeof(ethernet_header) + sizeof(ip_header) 727 * + sizeof(tcp_header). 725 728 */ 726 729 SIMPLE_FUNCTION … … 730 733 * @param packet the packet opaque pointer 731 734 * @return the size of the packet as it was on the wire. 732 * @author Perry Lorier733 * @author Daniel Lawson734 735 * @note Due to the trace being a header capture, or anonymisation this may 735 736 * not be the same as the Capture Len. -
lib/libtrace_int.h
r6dbc47a r52f8fc2 175 175 int (*get_framing_length)(const libtrace_packet_t *packet); 176 176 size_t (*set_capture_length)(struct libtrace_packet_t *packet,size_t size); 177 int (*get_fd)(const libtrace_ packet_t *packet);177 int (*get_fd)(const libtrace_t *trace); 178 178 struct libtrace_eventobj_t (*trace_event)(libtrace_t *trace, libtrace_packet_t *packet); 179 179 void (*help)(); -
lib/trace.c
r91c9552 r52f8fc2 558 558 * 559 559 */ 560 int trace_read_packet( struct libtrace_t *libtrace, structlibtrace_packet_t *packet) {560 int trace_read_packet(libtrace_t *libtrace, libtrace_packet_t *packet) { 561 561 562 562 assert(libtrace && "You called trace_read_packet() with a NULL libtrace parameter!\n"); … … 1027 1027 * @author Daniel Lawson 1028 1028 */ 1029 uint64_t trace_get_erf_timestamp(const structlibtrace_packet_t *packet) {1029 uint64_t trace_get_erf_timestamp(const libtrace_packet_t *packet) { 1030 1030 uint64_t timestamp = 0; 1031 1031 double seconds = 0.0; … … 1058 1058 * @author Perry Lorier 1059 1059 */ 1060 struct timeval trace_get_timeval(const structlibtrace_packet_t *packet) {1060 struct timeval trace_get_timeval(const libtrace_packet_t *packet) { 1061 1061 struct timeval tv; 1062 1062 uint64_t ts = 0; … … 1121 1121 } 1122 1122 1123 /* Get the size of the packet in the trace1124 * @param packet the packet opaque pointer1125 * @returns the size of the packet in the trace1126 * @author Perry Lorier1127 * @note The return size refers to the network-level payload of the packet and1128 * does not include any capture headers. For example, an Ethernet packet with1129 * an empty TCP packet will return sizeof(ethernet_header) + sizeof(ip_header)1130 * + sizeof(tcp_header).1131 * @note Due to this being a header capture, or anonymisation, this may not1132 * be the same size as the original packet. See trace_get_wire_length() for the1133 * original size of the packet.1134 * @note This can (and often is) different for different packets in a trace!1135 * @note This is sometimes called the "snaplen".1136 */1137 1123 int trace_get_capture_length(const struct libtrace_packet_t *packet) { 1138 1124 … … 1173 1159 */ 1174 1160 SIMPLE_FUNCTION 1175 int trace_get_framing_length(const structlibtrace_packet_t *packet) {1161 int trace_get_framing_length(const libtrace_packet_t *packet) { 1176 1162 if (packet->trace->format->get_framing_length) { 1177 1163 return packet->trace->format->get_framing_length(packet); … … 1187 1173 * @author Daniel Lawson 1188 1174 */ 1189 libtrace_linktype_t trace_get_link_type(const structlibtrace_packet_t *packet ) {1175 libtrace_linktype_t trace_get_link_type(const libtrace_packet_t *packet ) { 1190 1176 if (packet->trace->format->get_link_type) { 1191 1177 return packet->trace->format->get_link_type(packet);
Note: See TracChangeset
for help on using the changeset viewer.