Changeset 85a79b0
- Timestamp:
- 08/25/06 15:47:43 (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:
- e283596
- Parents:
- e373992
- Location:
- lib
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/fifo.c
r77285d9 r85a79b0 72 72 /* Set up our fifo 73 73 */ 74 struct tracefifo_t *fifo = malloc(sizeof(struct tracefifo_t)); 74 struct tracefifo_t *fifo = 75 (struct tracefifo_t*)malloc(sizeof(struct tracefifo_t)); 75 76 assert(size > 0); 76 77 … … 106 107 } 107 108 108 void tracefifo_flush( struct tracefifo_t *fifo UNUSED) {109 void tracefifo_flush(UNUSED struct tracefifo_t *fifo) { 109 110 /* do nothing */ 110 111 return; -
lib/format_duck.c
rc28b5c7 r85a79b0 47 47 #define INPUT DATA(libtrace) 48 48 #define OUTPUT DATAOUT(libtrace) 49 50 51 static struct libtrace_format_t duck;52 49 53 50 struct duck_format_data_t { … … 202 199 203 200 static int duck_write_packet(libtrace_out_t *libtrace, 204 const libtrace_packet_t *packet) { 201 libtrace_packet_t *packet) 202 { 205 203 206 204 int numbytes = 0; … … 228 226 if ((numbytes = libtrace_io_write(OUTPUT->file, packet->payload, 229 227 trace_get_capture_length(packet))) != 230 trace_get_capture_length(packet)) {228 (int)trace_get_capture_length(packet)) { 231 229 trace_set_err_out(libtrace, errno, "Writing DUCK failed"); 232 230 return -1; -
lib/format_legacy.c
rc0cd256 r85a79b0 56 56 # define O_LARGEFILE 0 57 57 #endif 58 59 static struct libtrace_format_t legacypos;60 static struct libtrace_format_t legacyeth;61 static struct libtrace_format_t legacyatm;62 58 63 59 #define DATA(x) ((struct legacy_format_data_t *)x->format_data) -
lib/format_linux.c
rc0cd256 r85a79b0 49 49 #include <net/if.h> 50 50 #include <sys/ioctl.h> 51 52 static struct libtrace_format_t linuxnative;53 51 54 52 struct libtrace_format_data_t { … … 218 216 packet->payload = (char*)packet->buffer+sizeof(*hdr); 219 217 220 hdr=( void*)packet->buffer;218 hdr=(struct libtrace_linuxnative_header*)packet->buffer; 221 219 socklen=sizeof(hdr->hdr); 222 220 snaplen=LIBTRACE_MIN( … … 227 225 snaplen, 228 226 MSG_TRUNC, 229 ( void*)&hdr->hdr,227 (struct sockaddr *)&hdr->hdr, 230 228 &socklen); 231 229 … … 242 240 243 241 static int linuxnative_write_packet(libtrace_out_t *trace, 244 constlibtrace_packet_t *packet)242 libtrace_packet_t *packet) 245 243 { 246 244 struct sockaddr_ll hdr; … … 272 270 default: /* shrug, beyond me! */ 273 271 printf("unknown type %x\n",linktype); 274 return -1;272 return (libtrace_linktype_t)~0U; 275 273 } 276 274 } … … 300 298 } 301 299 302 static int linuxnative_get_framing_length(const libtrace_packet_t *packet) 300 static int linuxnative_get_framing_length(UNUSED 301 const libtrace_packet_t *packet) 303 302 { 304 303 return sizeof(struct libtrace_linuxnative_header); -
lib/format_pcap.c
re373992 r85a79b0 181 181 switch(option) { 182 182 case TRACE_OPTION_FILTER: 183 DATA(libtrace)->filter= data;183 DATA(libtrace)->filter=(libtrace_filter_t*)data; 184 184 return 0; 185 185 case TRACE_OPTION_SNAPLEN: … … 306 306 } 307 307 308 static int pcap_write_packet(libtrace_out_t *libtrace, const libtrace_packet_t *packet) { 308 static int pcap_write_packet(libtrace_out_t *libtrace, 309 libtrace_packet_t *packet) 310 { 309 311 struct pcap_pkthdr pcap_pkt_hdr; 310 312 … … 366 368 } 367 369 368 static int pcapint_write_packet(libtrace_out_t *libtrace, const libtrace_packet_t *packet) { 370 static int pcapint_write_packet(libtrace_out_t *libtrace, 371 libtrace_packet_t *packet) 372 { 369 373 int err; 370 374 … … 498 502 } 499 503 500 static int pcap_get_framing_length( const libtrace_packet_t *packet UNUSED) {504 static int pcap_get_framing_length(UNUSED const libtrace_packet_t *packet) { 501 505 return sizeof(struct pcap_pkthdr); 502 506 } -
lib/format_rt.c
rc0cd256 r85a79b0 90 90 libtrace_t *dummy_linux; 91 91 }; 92 93 static struct libtrace_format_t rt;94 92 95 93 static int rt_connect(libtrace_t *libtrace) { -
lib/format_wag.c
r8e6ac85 r85a79b0 56 56 # include <io.h> 57 57 # include <share.h> 58 #else 59 # include <sys/ioctl.h> 58 60 #endif 59 61 … … 396 398 } 397 399 398 static int wtf_write_packet(libtrace_out_t *libtrace, const libtrace_packet_t *packet) { 400 static int wtf_write_packet(libtrace_out_t *libtrace, libtrace_packet_t *packet) 401 { 399 402 int numbytes =0 ; 400 403 if (packet->trace->format != &wag_trace) { … … 410 413 if ((numbytes = libtrace_io_write(OUTPUT.file, packet->header, 411 414 trace_get_framing_length(packet))) 412 != trace_get_framing_length(packet)) {415 !=(int)trace_get_framing_length(packet)) { 413 416 trace_set_err_out(libtrace,errno, 414 417 "write(%s)",packet->trace->uridata); … … 417 420 if ((numbytes = libtrace_io_write(OUTPUT.file, packet->payload, 418 421 trace_get_capture_length(packet)) 419 != trace_get_capture_length(packet))) {422 != (int)trace_get_capture_length(packet))) { 420 423 trace_set_err_out(libtrace, 421 424 errno,"write(%s)",packet->trace->uridata); -
lib/libtraceio-zlib.c
r46dd1e3 r85a79b0 5 5 6 6 struct libtrace_io_t { 7 gzFile *file;7 gzFile file; 8 8 }; 9 9 … … 35 35 libtrace_io_t *libtrace_io_fdopen(int fd, const char *mode) 36 36 { 37 libtrace_io_t *io = malloc(sizeof(libtrace_io_t));37 libtrace_io_t *io = (libtrace_io_t*)malloc(sizeof(libtrace_io_t)); 38 38 io->file = gzdopen(fd,mode); 39 39 return io; … … 42 42 libtrace_io_t *libtrace_io_open(const char *path, const char *mode) 43 43 { 44 libtrace_io_t *io = malloc(sizeof(libtrace_io_t));44 libtrace_io_t *io = (libtrace_io_t*)malloc(sizeof(libtrace_io_t)); 45 45 io->file = gzopen(path,mode); 46 46 return io; -
lib/linktypes.c
rdcbc330 r85a79b0 108 108 case TRACE_TYPE_ETH: 109 109 /* This should be easy, just prepend the header */ 110 tmpbuffer= malloc(sizeof(libtrace_sll_header_t) 110 tmpbuffer= (char*)malloc( 111 sizeof(libtrace_sll_header_t) 111 112 +trace_get_capture_length(packet) 112 113 +trace_get_framing_length(packet) 113 114 ); 114 115 115 hdr=( void*)((char*)tmpbuffer116 hdr=(libtrace_sll_header_t*)((char*)tmpbuffer 116 117 +trace_get_framing_length(packet)); 117 118 -
lib/protocols.c
rc0fdf31 r85a79b0 640 640 struct sockaddr_in *addr4=(struct sockaddr_in*)addr; 641 641 libtrace_ip_t *ip = (libtrace_ip_t*)l3; 642 ports = trace_get_payload_from_ip(ip,NULL,&remaining); 642 ports = (struct ports_t*) 643 trace_get_payload_from_ip(ip,NULL,&remaining); 643 644 addr4->sin_family=AF_INET; 644 645 if (ports && remaining>=sizeof(*ports)) … … 653 654 struct sockaddr_in6 *addr6=(struct sockaddr_in6*)addr; 654 655 libtrace_ip6_t *ip6 = (libtrace_ip6_t*)l3; 655 ports = trace_get_payload_from_ip6(ip6,NULL,&remaining); 656 ports = (struct ports_t*) 657 trace_get_payload_from_ip6(ip6,NULL,&remaining); 656 658 addr6->sin6_family=AF_INET6; 657 659 if (ports && remaining>=sizeof(*ports)) -
lib/trace.c
r4dfa44e r85a79b0 637 637 free(packet->buffer); 638 638 } 639 packet->buf_control='\0'; /* an "bad" value to force an assert 640 * if this packet is ever reused 641 */ 639 packet->buf_control=(buf_control_t)'\0'; 640 /* an "bad" value to force an assert 641 * if this packet is ever reused 642 */ 642 643 free(packet); 643 644 } … … 685 686 } 686 687 trace_set_err(libtrace,TRACE_ERR_UNSUPPORTED,"This format does not support reading packets\n"); 687 packet->size= -1;688 return -1;688 packet->size=~0U; 689 return ~0U; 689 690 } 690 691 … … 832 833 return packet->trace->format->get_capture_length(packet); 833 834 } 834 return -1;835 return ~0U; 835 836 } 836 837 … … 850 851 return packet->trace->format->get_wire_length(packet); 851 852 } 852 return -1;853 return ~0U; 853 854 854 855 } … … 867 868 return packet->trace->format->get_framing_length(packet); 868 869 } 869 return -1;870 return ~0U; 870 871 } 871 872 … … 975 976 return -1; 976 977 } 977 if (libtrace_to_pcap_dlt(linktype) == ~0U) {978 if (libtrace_to_pcap_dlt(linktype) == -1) { 978 979 trace_set_err(packet->trace,TRACE_ERR_BAD_PACKET, 979 980 "Unknown pcap equivilent linktype"); … … 1024 1025 1025 1026 assert(filter->flag); 1026 return bpf_filter(filter->filter.bf_insns, linkptr, clen,clen);1027 return bpf_filter(filter->filter.bf_insns,(u_char*)linkptr,clen,clen); 1027 1028 #else 1028 1029 fprintf(stderr,"This version of libtrace does not have bpf filter support\n"); … … 1044 1045 return packet->trace->format->set_direction(packet,direction); 1045 1046 } 1046 return -1;1047 return (libtrace_direction_t)~0U; 1047 1048 } 1048 1049 … … 1063 1064 return packet->trace->format->get_direction(packet); 1064 1065 } 1065 return -1;1066 return (libtrace_direction_t)~0U; 1066 1067 } 1067 1068 … … 1079 1080 * @param dest the TCP or UDP destination port 1080 1081 * @returns a hint as to which port is the server port 1081 * @author Daniel Lawson 1082 */ 1083 DLLEXPORT int8_t trace_get_server_port(uint8_t protocol UNUSED, uint16_t source, uint16_t dest) { 1082 */ 1083 DLLEXPORT int8_t trace_get_server_port(UNUSED uint8_t protocol, 1084 uint16_t source, uint16_t dest) 1085 { 1084 1086 /* 1085 1087 * * If the ports are equal, return DEST … … 1203 1205 } 1204 1206 1205 return -1;1207 return ~0U; 1206 1208 } 1207 1209
Note: See TracChangeset
for help on using the changeset viewer.