b.a.t.m.a.n.lists.open-mesh.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew.lunn@ascom.ch>
To: "B.A.T.M.A.N" <b.a.t.m.a.n@lists.open-mesh.net>
Subject: [B.A.T.M.A.N.] [batman-adv] packet.h coding style cleanup
Date: Fri, 17 Jul 2009 19:25:21 +0200	[thread overview]
Message-ID: <20090717172521.GB4656@ma.tech.ascom.ch> (raw)

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 <andrew.lunn@ascom.ch>
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));

             reply	other threads:[~2009-07-17 17:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-17 17:25 Andrew Lunn [this message]
2009-07-17 17:46 ` [B.A.T.M.A.N.] [batman-adv] packet.h coding style cleanup Andrew Lunn
2009-07-17 18:46 ` [B.A.T.M.A.N.] [batman-adv v2] " Andrew Lunn
2009-07-17 19:39   ` Marek Lindner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090717172521.GB4656@ma.tech.ascom.ch \
    --to=andrew.lunn@ascom.ch \
    --cc=b.a.t.m.a.n@lists.open-mesh.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).