Changeset 1f2220f
- Timestamp:
- 08/02/05 16:47:43 (15 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:
- 91ebc50
- Parents:
- bbc3497
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/format_wag.c
r37a39b7 r1f2220f 124 124 } 125 125 126 static int wag_read(struct libtrace_t *libtrace, void *buffer, size_t len) { 127 int numbytes; 128 static short lctr = 0; 129 int rlen; 130 assert(libtrace); 131 assert(len >= 0); 132 133 if (buffer == 0) 134 buffer = malloc(len); 135 136 while(1) { 137 switch(libtrace->sourcetype) { 138 case DEVICE: 139 if ((numbytes=read(libtrace->input.fd, 140 buffer, 141 len)) == -1) { 142 perror("read"); 143 return -1; 144 } 145 break; 146 default: 147 #if HAVE_ZLIB 148 if ((numbytes=gzread(libtrace->input.file, 149 buffer, 150 len)) == -1) { 151 perror("gzread"); 152 return -1; 153 } 154 #else 155 if ((numbytes=fread(buffer,len,1, 156 libtrace->input.file)) == 0 ) { 157 if(feof(libtrace->input.file)) { 158 return 0; 159 } 160 if(ferror(libtrace->input.file)) { 161 perror("fread"); 162 return -1; 163 } 164 return 0; 165 } 166 #endif 167 } 168 break; 169 } 170 return numbytes; 171 172 } 173 174 126 175 static int wag_read_packet(struct libtrace_t *libtrace, struct libtrace_packet_t *packet) { 127 176 int numbytes; … … 155 204 continue; 156 205 } 206 157 207 size = ntohs(((struct wag_frame_hdr *)buffer)->size); 158 208 209 // wag isn't in network byte order yet 210 size = htons(size); 211 //printf("%d %d\n",size,htons(size)); 212 159 213 // read in full packet 160 if((numbytes = fifo_out_rea D(libtrace->fifo,buffer,size)) == 0) {214 if((numbytes = fifo_out_read(libtrace->fifo,buffer,size)) == 0) { 161 215 fifo_out_reset(libtrace->fifo); 162 216 read_required = 1; … … 203 257 static int wag_get_capture_length(const struct libtrace_packet_t *packet) { 204 258 struct wag_data_frame *wagptr = (struct wag_data_frame *)packet->buffer; 205 return ntohs(wagptr->hdr.size); 259 return (wagptr->hdr.size); 260 //return ntohs(wagptr->hdr.size); 206 261 } 207 262 208 263 static int wag_get_wire_length(const struct libtrace_packet_t *packet) { 209 264 struct wag_data_frame *wagptr = (struct wag_data_frame *)packet->buffer; 210 return ntohs(wagptr->hdr.size); 265 return (wagptr->hdr.size); 266 //return ntohs(wagptr->hdr.size); 211 267 } 212 268
Note: See TracChangeset
for help on using the changeset viewer.