pnet 0.7.3

Cross-platform, low level networking using the Rust programming language.
diff --git a/examples/packetdump.rs b/examples/packetdump.rs
index f6eeb03..6ac9950 100644
--- a/examples/packetdump.rs
+++ b/examples/packetdump.rs
@@ -41,12 +41,12 @@ fn handle_udp_packet(interface_name: &str, source: IpAddr, destination: IpAddr,
 }
 
 fn handle_icmp_packet(interface_name: &str, source: IpAddr, destination: IpAddr, packet: &[u8]) {
-    let icmp_packet = IcmpPacket(packet);
+    let icmp_packet = IcmpPacket::new(packet);
     if let Some(icmp_packet) = icmp_packet {
-        match icmp_packet.get_type() {
+        match icmp_packet.get_icmp_type() {
             icmp_types::EchoReply => {
-                echo_reply_packet = echo_reply::EchoReplyPacket(packet);
-                println!("[{}]: ICMP echo reply {} -> {} (seq={}, id={})",
+                let echo_reply_packet = echo_reply::EchoReplyPacket::new(packet).unwrap();
+                println!("[{}]: ICMP echo reply {} -> {} (seq={:?}, id={:?})",
                         interface_name,
                         source,
                         destination,
@@ -54,19 +54,19 @@ fn handle_icmp_packet(interface_name: &str, source: IpAddr, destination: IpAddr,
                         echo_reply_packet.get_identifier());
             },
             icmp_types::EchoRequest => {
-                echo_request_packet = echo_request::EchoRequestPacket(packet);
-                println!("[{}]: ICMP echo request {} -> {} (seq={}, id={})",
+                let echo_request_packet = echo_request::EchoRequestPacket::new(packet).unwrap();
+                println!("[{}]: ICMP echo request {} -> {} (seq={:?}, id={:?})",
                         interface_name,
                         source,
                         destination,
                         echo_request_packet.get_sequence_number(),
                         echo_request_packet.get_identifier());
             },
-            _ => println!("[{}]: ICMP packet {} -> {} (type={})",
+            _ => println!("[{}]: ICMP packet {} -> {} (type={:?})",
                         interface_name,
                         source,
                         destination,
-                        icmp_packet.get_type()),
+                        icmp_packet.get_icmp_type()),
         }
     } else {
         println!("[{}]: Malformed ICMP Packet", interface_name);
diff --git a/pnet_macros/src/decorator.rs b/pnet_macros/src/decorator.rs
index ee89b4a..1d9b169 100644
--- a/pnet_macros/src/decorator.rs
+++ b/pnet_macros/src/decorator.rs
@@ -86,6 +86,7 @@ fn make_type(ty_str: String) -> Result<Type, String> {
 fn make_packet(ecx: &mut ExtCtxt, span: Span, name: String, vd: &ast::VariantData) -> Option<Packet> {
     let mut payload_span = None;
     let mut fields = Vec::new();
+    println!("name: {}", name);
 
     // FIXME This is an ugly hack to match the old behaviour
     let sfields = match *vd {
diff --git a/src/packet/icmp.rs b/src/packet/icmp.rs
index 7a4189b..08441a3 100644
--- a/src/packet/icmp.rs
+++ b/src/packet/icmp.rs
@@ -10,6 +10,8 @@
 
 use packet::{Packet, PrimitiveValues};
 
+use pnet_macros_support::types::*;
+
 /// Represents the "ICMP type" header field.
 #[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
 pub struct IcmpType(pub u8);
@@ -48,12 +50,12 @@ impl PrimitiveValues for IcmpCode {
 
 /// Represents a generic ICMP packet
 #[packet]
-pub struct IcmpPacket {
+pub struct Icmp {
     #[construct_with(u8)]
     icmp_type: IcmpType,
     #[construct_with(u8)]
     icmp_code: IcmpCode,
-    checksum: u16,
+    checksum: u16be,
     // theoritically, the header is 64 bytes long, but since the "Rest Of Header" part depends on
     // the ICMP type and ICMP code, we consider it's part of the payload.
     // rest_of_header: u32be,
@@ -107,6 +109,8 @@ pub mod echo_reply {
     use packet::{Packet, PrimitiveValues};
     use packet::icmp::{IcmpCode, IcmpType};
 
+    use pnet_macros_support::types::*;
+
     /// Represent the "identifier" field of the ICMP echo replay header.
     #[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
     pub struct Identifier(pub u16);
@@ -155,14 +159,14 @@ pub mod echo_reply {
 
     /// Represents an ICMP echo reply packet.
     #[packet]
-    pub struct EchoReplyPacket {
+    pub struct EchoReply {
         #[construct_with(u8)]
         icmp_type: IcmpType,
         #[construct_with(u8)]
         icmp_code: IcmpCode,
-        checksum: u16,
-        identifier: u16,
-        sequence_number: u16,
+        checksum: u16be,
+        identifier: u16be,
+        sequence_number: u16be,
         #[payload]
         payload: Vec<u8>,
     }
@@ -173,6 +177,8 @@ pub mod echo_request {
     use packet::{Packet, PrimitiveValues};
     use packet::icmp::{IcmpCode, IcmpType};
 
+    use pnet_macros_support::types::*;
+
     /// Represents an indentifier field
     #[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
     pub struct Identifier(pub u16);
@@ -221,14 +227,14 @@ pub mod echo_request {
 
     /// Represents an "echo request" ICMP packet.
     #[packet]
-    pub struct EchoRequestPacket {
+    pub struct EchoRequest {
         #[construct_with(u8)]
         icmp_type: IcmpType,
         #[construct_with(u8)]
         icmp_code: IcmpCode,
-        checksum: u16,
-        identifier: u16,
-        sequence_number: u16,
+        checksum: u16be,
+        identifier: u16be,
+        sequence_number: u16be,
         #[payload]
         payload: Vec<u8>,
     }
@@ -238,6 +244,8 @@ pub mod echo_request {
 pub mod destination_unreachable {
     use packet::icmp::{IcmpCode, IcmpType};
 
+    use pnet_macros_support::types::*;
+
     /// Enumeration of the recognized ICMP codes for "destination unreachable" ICMP packets.
     #[allow(non_snake_case)]
 	#[allow(non_upper_case_globals)]
@@ -284,7 +292,7 @@ pub mod destination_unreachable {
         icmp_type: IcmpType,
         #[construct_with(u8)]
         icmp_code: IcmpCode,
-        checksum: u16,
+        checksum: u16be,
         unused: u32,
         #[payload]
         payload: Vec<u8>,