Changeset 925
- Timestamp:
- 08/21/06 22:10:42 (7 years ago)
- Location:
- trunk/lib
- Files:
-
- 4 edited
-
format_erf.c (modified) (3 diffs)
-
libtrace.h.in (modified) (1 diff)
-
libtrace_int.h (modified) (1 diff)
-
trace.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/format_erf.c
r924 r925 900 900 return 0; 901 901 } 902 903 static bool find_compatible_linktype(libtrace_packet_t *packet) 904 { 905 /* Keep trying to simplify the packet until we can find 906 * something we can do with it */ 907 do { 908 char type=libtrace_to_erf_type(trace_get_link_type(packet)); 909 910 /* Success */ 911 if (type != (char)-1) 912 return true; 913 914 if (!demote_packet(packet)) { 915 trace_set_err_out(packet->trace, 916 TRACE_ERR_NO_CONVERSION, 917 "No erf type for packet (%i)", 918 trace_get_link_type(packet)); 919 return false; 920 } 921 922 } while(1); 923 924 return true; 925 } 902 926 903 927 static int erf_write_packet(libtrace_out_t *libtrace, … … 940 964 } else { 941 965 dag_record_t erfhdr; 942 int type;943 966 /* convert format - build up a new erf header */ 944 967 /* Timestamp */ … … 950 973 erfhdr.flags.iface = trace_get_direction(packet); 951 974 952 /* Keep trying to simplify the packet until we can find 953 * something we can do with it */ 954 do { 955 type=libtrace_to_erf_type(trace_get_link_type(packet)); 956 } while(type==(char)-1 && demote_packet((libtrace_packet_t *)packet)); 957 /* We just don't support this link type sorry */ 958 if (type==(char)-1) { 959 trace_set_err_out(libtrace, 960 TRACE_ERR_NO_CONVERSION, 961 "No erf type for packet"); 975 if (!find_compatible_linktype(packet)) 962 976 return -1; 963 } 964 erfhdr.type = type; 977 978 erfhdr.type = libtrace_to_erf_type(trace_get_link_type(packet)); 979 965 980 /* Packet length (rlen includes format overhead) */ 966 981 assert(trace_get_capture_length(packet)>0 -
trunk/lib/libtrace.h.in
r922 r925 738 738 * @return the number of bytes written out, if zero or negative then an error has occured. 739 739 */ 740 DLLEXPORT int trace_write_packet(libtrace_out_t *trace, constlibtrace_packet_t *packet);740 DLLEXPORT int trace_write_packet(libtrace_out_t *trace, libtrace_packet_t *packet); 741 741 /*@}*/ 742 742 -
trunk/lib/libtrace_int.h
r921 r925 237 237 * (or NULL if output not supported) 238 238 */ 239 int (*write_packet)(libtrace_out_t *libtrace, constlibtrace_packet_t *packet);239 int (*write_packet)(libtrace_out_t *libtrace, libtrace_packet_t *packet); 240 240 /** return the libtrace link type for this packet 241 241 * @return the libtrace link type, or -1 if this link type is unknown -
trunk/lib/trace.c
r904 r925 697 697 * @author Shane Alcock 698 698 * */ 699 DLLEXPORT int trace_write_packet(libtrace_out_t *libtrace, constlibtrace_packet_t *packet) {699 DLLEXPORT int trace_write_packet(libtrace_out_t *libtrace, libtrace_packet_t *packet) { 700 700 assert(libtrace); 701 701 assert(packet);
Note: See TracChangeset
for help on using the changeset viewer.
