| 622 | } |
| 623 | |
| 624 | fn print(&self) { |
| 625 | print!( |
| 626 | "{} {} {} ", |
| 627 | self.eth.get_source(), |
| 628 | self.eth.get_destination(), |
| 629 | self.eth.get_ethertype() |
| 630 | ); |
| 631 | if let Some(ref ipv4) = self.ipv4 { |
| 632 | print!( |
| 633 | "{} {} {} ", |
| 634 | ipv4.get_source(), |
| 635 | ipv4.get_destination(), |
| 636 | ipv4.get_next_level_protocol() |
| 637 | ); |
| 638 | } |
| 639 | if let Some(ref udp) = self.udp { |
| 640 | print!( |
| 641 | "{} {} {}", |
| 642 | udp.get_source(), |
| 643 | udp.get_destination(), |
| 644 | str::from_utf8(udp.payload()).unwrap() |
| 645 | ); |
| 646 | } |
| 647 | println!(); |
| 648 | } |
| 649 | } |
| 650 | |
| 651 | // Given a buffer of appropriate size, this fills in the relevant fields based on the |