Changeset f0b9060
- Timestamp:
- 07/03/06 13:20:45 (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:
- 5bb5dd2
- Parents:
- b49ea36
- Location:
- swig
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
swig/libtrace.i
r47de0aa rf0b9060 153 153 trace_destroy_packet(self); 154 154 } 155 libtrace_packet_t * trace_copy_packet() {155 libtrace_packet_t *copy_packet() { 156 156 return trace_copy_packet(self); 157 157 } 158 void * trace_get_link() {158 void *get_link() { 159 159 return trace_get_link(self); 160 160 } 161 void * trace_get_transport(uint8_t *proto, uint32_t *remaining) {161 void *get_transport(uint8_t *proto, uint32_t *remaining) { 162 162 return trace_get_transport(self, proto, remaining); 163 163 } 164 struct libtrace_ip * trace_get_ip() {164 struct libtrace_ip *get_ip() { 165 165 return trace_get_ip(self); 166 166 } 167 struct libtrace_tcp * trace_get_tcp() {167 struct libtrace_tcp *get_tcp() { 168 168 return trace_get_tcp(self); 169 169 } 170 struct libtrace_udp * trace_get_udp() {170 struct libtrace_udp *get_udp() { 171 171 return trace_get_udp(self); 172 172 } 173 struct libtrace_icmp * trace_get_icmp() {173 struct libtrace_icmp *get_icmp() { 174 174 return trace_get_icmp(self); 175 175 } 176 char * trace_get_destination_mac() {176 char *get_destination_mac() { 177 177 return trace_ether_ntoa(trace_get_destination_mac(self),0); 178 178 } 179 char * trace_get_source_mac() {179 char *get_source_mac() { 180 180 return trace_ether_ntoa(trace_get_source_mac(self),0); 181 181 } 182 char * trace_ether_ntoa(uint8_t *mac) {182 char *ether_ntoa(uint8_t *mac) { 183 183 return trace_ether_ntoa(mac, 0); 184 184 } 185 uint16_t trace_get_source_port() {185 uint16_t get_source_port() { 186 186 return trace_get_source_port(self); 187 187 } 188 uint16_t trace_get_destination_port() {188 uint16_t get_destination_port() { 189 189 return trace_get_destination_port(self); 190 190 } 191 double trace_get_seconds() {191 double get_seconds() { 192 192 return trace_get_seconds(self); 193 193 } 194 uint64_t trace_get_erf_timestamp() {194 uint64_t get_erf_timestamp() { 195 195 return trace_get_erf_timestamp(self); 196 196 } 197 struct timeval trace_get_timeval() {197 struct timeval get_timeval() { 198 198 return trace_get_timeval(self); 199 199 } 200 int trace_get_capture_length() {200 int get_capture_length() { 201 201 return trace_get_capture_length(self); 202 202 } 203 size_t trace_set_capture_length(size_t size) {203 size_t set_capture_length(size_t size) { 204 204 return trace_set_capture_length(self,size); 205 205 } 206 int trace_get_wire_lenth() {206 int get_wire_lenth() { 207 207 return trace_get_wire_length(self); 208 208 } 209 int trace_get_framing_length() {209 int get_framing_length() { 210 210 return trace_get_framing_length(self); 211 211 } 212 libtrace_linktype_t trace_get_link_type() {212 libtrace_linktype_t get_link_type() { 213 213 return trace_get_link_type(self); 214 214 } 215 int8_t trace_get_direction() {215 int8_t get_direction() { 216 216 return trace_get_direction(self); 217 217 } 218 int8_t trace_set_direction(int8_t direction) {218 int8_t set_direction(int8_t direction) { 219 219 return trace_set_direction(self,direction); 220 220 } 221 int trace_apply_filter(struct libtrace_filter_t *filter) {221 int apply_filter(struct libtrace_filter_t *filter) { 222 222 return trace_apply_filter(filter,self); 223 223 } 224 uint8_t trace_get_server_port(uint8_t protocol, uint16_t source,224 uint8_t get_server_port(uint8_t protocol, uint16_t source, 225 225 uint16_t dest) { 226 226 return trace_get_server_port(protocol,source,dest); … … 239 239 trace_destroy_filter(self); 240 240 }; 241 int trace_apply_filter(struct libtrace_packet_t *packet) {241 int apply_filter(struct libtrace_packet_t *packet) { 242 242 return trace_apply_filter(self,packet); 243 243 } … … 250 250 libtrace_t(char *uri) { return trace_create(uri); }; 251 251 ~libtrace_t() { trace_destroy(self); } 252 int trace_read_packet(struct libtrace_packet_t *packet) {252 int read_packet(struct libtrace_packet_t *packet) { 253 253 return trace_read_packet(self,packet); 254 254 } 255 int trace_start() {255 int start() { 256 256 return trace_start(self); 257 257 } 258 int trace_pause() {258 int pause() { 259 259 return trace_pause(self); 260 260 } 261 void trace_help() {261 void help() { 262 262 trace_help(); 263 263 } 264 int trace_config(trace_option_t option, void *value) {264 int config(trace_option_t option, void *value) { 265 265 return trace_config(self, option, value); 266 266 } 267 libtrace_err_t trace_get_err() {267 libtrace_err_t get_err() { 268 268 return trace_get_err(self); 269 269 } 270 bool trace_is_err() {270 bool is_err() { 271 271 return trace_is_err(self); 272 272 } … … 279 279 libtrace_out_t(char *uri) { return trace_create_output(uri); }; 280 280 ~libtrace_t() { trace_destroy_output(self); } 281 int trace_start_output() {281 int start_output() { 282 282 return trace_start_output(self); 283 283 } 284 int trace_config_output(trace_option_output_t option, void *value) {284 int config_output(trace_option_output_t option, void *value) { 285 285 return trace_config_output(self, option, value); 286 286 } 287 libtrace_err_t trace_get_err_output() {287 libtrace_err_t get_err_output() { 288 288 return trace_get_err_output(self); 289 289 } 290 bool trace_is_err_output() {290 bool is_err_output() { 291 291 return trace_is_err_output(self); 292 292 } 293 int trace_write_packet(libtrace_packet_t *packet) {293 int write_packet(libtrace_packet_t *packet) { 294 294 return trace_write_packet(self, packet); 295 295 } -
swig/python/check.py
r47de0aa rf0b9060 6 6 trace = libtrace.Trace(sys.argv[1]) 7 7 8 if trace. trace_is_err():8 if trace.is_err(): 9 9 print "Trace failed: %s" % trace.trace_get_err() 10 10 sys.exit() … … 20 20 print "filter=",filter 21 21 22 ret=trace. trace_start()22 ret=trace.start() 23 23 24 24 if ret < 0: … … 27 27 28 28 while 1: 29 trace. trace_read_packet(packet)29 trace.read_packet(packet) 30 30 if not packet: 31 31 break 32 32 33 ippacket = packet. trace_get_ip()33 ippacket = packet.get_ip() 34 34 if not ippacket: 35 35 continue … … 39 39 print count 40 40 41 tcppacket = packet. trace_get_tcp()41 tcppacket = packet.get_tcp() 42 42 if not tcppacket: 43 43 continue 44 44 45 if not packet. trace_apply_filter(filter):45 if not packet.apply_filter(filter): 46 46 continue 47 47 48 src = packet. trace_get_source_port()49 dst = packet. trace_get_destination_port()50 if packet. trace_get_server_port(4,src,dst) == 0:48 src = packet.get_source_port() 49 dst = packet.get_destination_port() 50 if packet.get_server_port(4,src,dst) == 0: 51 51 print ippacket.ip_src,':',src,'->',ippacket.ip_dst,':',dst 52 52 else:
Note: See TracChangeset
for help on using the changeset viewer.