From patchwork Fri Jul 17 17:25:21 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Lunn X-Patchwork-Id: 5116 Return-Path: Received: from rubicon.hasler.ascom.ch (rubicon.hasler.ascom.ch [139.79.129.1]) by open-mesh.net (Postfix) with ESMTPS id 8368B154370 for ; Fri, 17 Jul 2009 17:49:32 +0000 (UTC) Received: from eiger.ma.tech.ascom.ch (eiger.ma.tech.ascom.ch [139.79.100.1]) by rubicon.hasler.ascom.ch (8.14.3/8.14.3) with ESMTP id n6HHPMld022326 for ; Fri, 17 Jul 2009 19:25:22 +0200 (MEST) Received: from [139.79.100.143] (helo=donkey.ma.tech.ascom.ch) by eiger.ma.tech.ascom.ch with esmtp (Exim 3.16 #1) id 1MRrBP-0004i7-00 for b.a.t.m.a.n@lists.open-mesh.net; Fri, 17 Jul 2009 19:25:19 +0200 Received: from lunn by donkey.ma.tech.ascom.ch with local (Exim 4.69) (envelope-from ) id 1MRrBR-0001Tl-Jk for b.a.t.m.a.n@lists.open-mesh.net; Fri, 17 Jul 2009 19:25:21 +0200 Date: Fri, 17 Jul 2009 19:25:21 +0200 From: Andrew Lunn To: "B.A.T.M.A.N" Message-ID: <20090717172521.GB4656@ma.tech.ascom.ch> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) Subject: [B.A.T.M.A.N.] [batman-adv] packet.h coding style cleanup X-BeenThere: b.a.t.m.a.n@lists.open-mesh.net X-Mailman-Version: 2.1.11 Precedence: list Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking List-Id: The list for a Better Approach To Mobile Ad-hoc Networking List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Jul 2009 17:49:32 -0000 Make packet.h clean with respect to the 2.6.29 checkpatch script. Also adds one macro, BAT_PACKET_LEN, which is used in other patches to follow. Signed-off-by: Andrew Lunn Index: batman-adv-kernelland/packet.h =================================================================== --- batman-adv-kernelland/packet.h (revision 1349) +++ batman-adv-kernelland/packet.h (working copy) @@ -17,8 +17,6 @@ * */ - - #define ETH_P_BATMAN 0x4305 /* unofficial/not registered Ethertype */ #define BAT_PACKET 0x01 @@ -32,7 +30,6 @@ #define DIRECTLINK 0x40 #define VIS_SERVER 0x20 - /* ICMP message types */ #define ECHO_REPLY 0 #define DESTINATION_UNREACHABLE 3 @@ -40,13 +37,11 @@ #define TTL_EXCEEDED 11 #define PARAMETER_PROBLEM 12 - /* vis defines */ #define VIS_TYPE_SERVER_SYNC 0 #define VIS_TYPE_CLIENT_UPDATE 1 -struct batman_packet -{ +struct batman_packet { uint8_t packet_type; uint8_t version; /* batman version field */ uint8_t flags; /* 0x40: DIRECTLINK flag, 0x20 VIS_SERVER flag... */ @@ -56,13 +51,15 @@ uint8_t old_orig[6]; uint8_t ttl; uint8_t num_hna; + uint16_t orig_interval; } __attribute__((packed)); -struct icmp_packet -{ +#define BAT_PACKET_LEN sizeof(struct batman_packet) + +struct icmp_packet { uint8_t packet_type; uint8_t version; /* batman version field */ - uint8_t msg_type; /* see ICMP message types above */ + uint8_t msg_type; /* see ICMP message types above */ uint8_t ttl; uint8_t dst[6]; uint8_t orig[6]; @@ -70,31 +67,29 @@ uint8_t uid; } __attribute__((packed)); -struct unicast_packet -{ +struct unicast_packet { uint8_t packet_type; uint8_t version; /* batman version field */ uint8_t dest[6]; uint8_t ttl; } __attribute__((packed)); -struct bcast_packet -{ +struct bcast_packet { uint8_t packet_type; uint8_t version; /* batman version field */ uint8_t orig[6]; uint16_t seqno; } __attribute__((packed)); -struct vis_packet -{ +struct vis_packet { uint8_t packet_type; - uint8_t version; /* batman version field */ - uint8_t vis_type; /* which type of vis-participant sent this? */ - uint8_t seqno; /* sequence number */ - uint8_t entries; /* number of entries behind this struct */ - uint8_t ttl; /* TTL */ - uint8_t vis_orig[6]; /* originator that informs about its neighbours */ - uint8_t target_orig[6]; /* who should receive this packet */ - uint8_t sender_orig[6]; /* who sent or rebroadcasted this packet */ + uint8_t version; /* batman version field */ + uint8_t vis_type; /* which type of vis-participant sent this? */ + uint8_t seqno; /* sequence number */ + uint8_t entries; /* number of entries behind this struct */ + uint8_t ttl; /* TTL */ + uint8_t vis_orig[6]; /* originator that informs about its + * neighbours */ + uint8_t target_orig[6]; /* who should receive this packet */ + uint8_t sender_orig[6]; /* who sent or rebroadcasted this packet */ } __attribute__((packed));