diff options
author | Christian Grothoff <christian@grothoff.org> | 2019-10-31 13:03:48 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2019-10-31 13:03:48 +0100 |
commit | 7e3cf5f461eb4fbb7581672bf0835da07c378136 (patch) | |
tree | bdc3874b7894242b095b892f1ed3e81a4d4f06c0 /src/transport/gnunet-helper-transport-wlan.c | |
parent | 01b480d6d026e0c537dc284a7e7df2c0320a3528 (diff) | |
download | gnunet-7e3cf5f461eb4fbb7581672bf0835da07c378136.tar.gz gnunet-7e3cf5f461eb4fbb7581672bf0835da07c378136.zip |
tighten formatting rules
Diffstat (limited to 'src/transport/gnunet-helper-transport-wlan.c')
-rw-r--r-- | src/transport/gnunet-helper-transport-wlan.c | 30 |
1 files changed, 11 insertions, 19 deletions
diff --git a/src/transport/gnunet-helper-transport-wlan.c b/src/transport/gnunet-helper-transport-wlan.c index 7ad6c5175..68adadbe8 100644 --- a/src/transport/gnunet-helper-transport-wlan.c +++ b/src/transport/gnunet-helper-transport-wlan.c | |||
@@ -176,7 +176,6 @@ | |||
176 | #define MAXLINE 4096 | 176 | #define MAXLINE 4096 |
177 | 177 | ||
178 | 178 | ||
179 | |||
180 | /* ********* structure of messages of type ARPHRD_IEEE80211_PRISM *********** */ | 179 | /* ********* structure of messages of type ARPHRD_IEEE80211_PRISM *********** */ |
181 | 180 | ||
182 | /** | 181 | /** |
@@ -465,7 +464,6 @@ enum RadiotapType | |||
465 | #define IEEE80211_RADIOTAP_PRESENT_EXTEND_MASK (1 << IEEE80211_RADIOTAP_EXT) | 464 | #define IEEE80211_RADIOTAP_PRESENT_EXTEND_MASK (1 << IEEE80211_RADIOTAP_EXT) |
466 | 465 | ||
467 | 466 | ||
468 | |||
469 | /** | 467 | /** |
470 | * Bit in IEEE80211_RADIOTAP_FLAGS (which we might get | 468 | * Bit in IEEE80211_RADIOTAP_FLAGS (which we might get |
471 | * as part of a 'struct Ieee80211RadiotapHeader' extension | 469 | * as part of a 'struct Ieee80211RadiotapHeader' extension |
@@ -651,7 +649,6 @@ struct RadiotapTransmissionHeader | |||
651 | IEEE80211_RADIOTAP_TX_FLAGS)) | 649 | IEEE80211_RADIOTAP_TX_FLAGS)) |
652 | 650 | ||
653 | 651 | ||
654 | |||
655 | /** | 652 | /** |
656 | * struct Ieee80211RadiotapHeaderIterator - tracks walk through present radiotap arguments | 653 | * struct Ieee80211RadiotapHeaderIterator - tracks walk through present radiotap arguments |
657 | * in the radiotap header. Used when we parse radiotap packets received from the kernel. | 654 | * in the radiotap header. Used when we parse radiotap packets received from the kernel. |
@@ -770,7 +767,6 @@ static struct SendBuffer write_pout; | |||
770 | static struct SendBuffer write_std; | 767 | static struct SendBuffer write_std; |
771 | 768 | ||
772 | 769 | ||
773 | |||
774 | /* *********** specialized version of server_mst.c begins here ********** */ | 770 | /* *********** specialized version of server_mst.c begins here ********** */ |
775 | 771 | ||
776 | /** | 772 | /** |
@@ -1031,6 +1027,7 @@ mst_destroy (struct MessageStreamTokenizer *mst) | |||
1031 | free (mst); | 1027 | free (mst); |
1032 | } | 1028 | } |
1033 | 1029 | ||
1030 | |||
1034 | /* ***************** end of server_mst.c clone ***************** **/ | 1031 | /* ***************** end of server_mst.c clone ***************** **/ |
1035 | 1032 | ||
1036 | 1033 | ||
@@ -1091,8 +1088,7 @@ ieee80211_radiotap_iterator_init (struct | |||
1091 | * check for insanity where the present bitmaps | 1088 | * check for insanity where the present bitmaps |
1092 | * keep claiming to extend up to or even beyond the | 1089 | * keep claiming to extend up to or even beyond the |
1093 | * stated radiotap header length | 1090 | * stated radiotap header length |
1094 | */ | 1091 | */if (iterator->arg - ((uint8_t*) iterator->rtheader) > |
1095 | if (iterator->arg - ((uint8_t*) iterator->rtheader) > | ||
1096 | iterator->max_length) | 1092 | iterator->max_length) |
1097 | return -1; | 1093 | return -1; |
1098 | } | 1094 | } |
@@ -1101,8 +1097,7 @@ ieee80211_radiotap_iterator_init (struct | |||
1101 | * no need to check again for blowing past stated radiotap | 1097 | * no need to check again for blowing past stated radiotap |
1102 | * header length, becuase ieee80211_radiotap_iterator_next | 1098 | * header length, becuase ieee80211_radiotap_iterator_next |
1103 | * checks it before it is dereferenced | 1099 | * checks it before it is dereferenced |
1104 | */ | 1100 | */} |
1105 | } | ||
1106 | /* we are all initialized happily */ | 1101 | /* we are all initialized happily */ |
1107 | return 0; | 1102 | return 0; |
1108 | } | 1103 | } |
@@ -1137,9 +1132,7 @@ ieee80211_radiotap_iterator_next (struct | |||
1137 | * | 1132 | * |
1138 | * upper nybble: content alignment for arg | 1133 | * upper nybble: content alignment for arg |
1139 | * lower nybble: content length for arg | 1134 | * lower nybble: content length for arg |
1140 | */ | 1135 | */static const uint8_t rt_sizes[] = { |
1141 | |||
1142 | static const uint8_t rt_sizes[] = { | ||
1143 | [IEEE80211_RADIOTAP_TSFT] = 0x88, | 1136 | [IEEE80211_RADIOTAP_TSFT] = 0x88, |
1144 | [IEEE80211_RADIOTAP_FLAGS] = 0x11, | 1137 | [IEEE80211_RADIOTAP_FLAGS] = 0x11, |
1145 | [IEEE80211_RADIOTAP_RATE] = 0x11, | 1138 | [IEEE80211_RADIOTAP_RATE] = 0x11, |
@@ -1198,8 +1191,7 @@ ieee80211_radiotap_iterator_next (struct | |||
1198 | * radiotap header. There is no guarantee that the radiotap | 1191 | * radiotap header. There is no guarantee that the radiotap |
1199 | * header itself is aligned on any kind of boundary, thus we | 1192 | * header itself is aligned on any kind of boundary, thus we |
1200 | * need to really look at the delta here. | 1193 | * need to really look at the delta here. |
1201 | */ | 1194 | */wanted_alignment = rt_sizes[iterator->arg_index] >> 4; |
1202 | wanted_alignment = rt_sizes[iterator->arg_index] >> 4; | ||
1203 | unalignment = (((void *) iterator->arg) - ((void *) iterator->rtheader)) | 1195 | unalignment = (((void *) iterator->arg) - ((void *) iterator->rtheader)) |
1204 | & (wanted_alignment - 1); | 1196 | & (wanted_alignment - 1); |
1205 | if (0 != unalignment) | 1197 | if (0 != unalignment) |
@@ -1224,8 +1216,7 @@ ieee80211_radiotap_iterator_next (struct | |||
1224 | * claims to have more arg content than the length of the | 1216 | * claims to have more arg content than the length of the |
1225 | * radiotap section. We will normally end up equalling this | 1217 | * radiotap section. We will normally end up equalling this |
1226 | * max_length on the last arg, never exceeding it. | 1218 | * max_length on the last arg, never exceeding it. |
1227 | */ | 1219 | */if ((((void *) iterator->arg) - ((void *) iterator->rtheader)) > |
1228 | if ((((void *) iterator->arg) - ((void *) iterator->rtheader)) > | ||
1229 | iterator->max_length) | 1220 | iterator->max_length) |
1230 | return -1; | 1221 | return -1; |
1231 | } | 1222 | } |
@@ -1365,8 +1356,8 @@ check_crc_buf_osdep (const unsigned char *buf, size_t len) | |||
1365 | 1356 | ||
1366 | crc = calc_crc_osdep (buf, len); | 1357 | crc = calc_crc_osdep (buf, len); |
1367 | buf += len; | 1358 | buf += len; |
1368 | if ((((crc) & 0xFF) == buf[0])&&(((crc >> 8) & 0xFF) == buf[1])&& | 1359 | if ((((crc) & 0xFF) == buf[0]) && (((crc >> 8) & 0xFF) == buf[1]) && |
1369 | ( ((crc >> 16) & 0xFF) == buf[2]) &&( ((crc >> 24) & 0xFF) == buf[3]) ) | 1360 | ( ((crc >> 16) & 0xFF) == buf[2]) && ( ((crc >> 24) & 0xFF) == buf[3]) ) |
1370 | return 0; | 1361 | return 0; |
1371 | return 1; | 1362 | return 1; |
1372 | } | 1363 | } |
@@ -1386,11 +1377,11 @@ check_crc_buf_osdep (const unsigned char *buf, size_t len) | |||
1386 | static int | 1377 | static int |
1387 | get_channel_from_frequency (int32_t frequency) | 1378 | get_channel_from_frequency (int32_t frequency) |
1388 | { | 1379 | { |
1389 | if ((frequency >= 2412)&&(frequency <= 2472)) | 1380 | if ((frequency >= 2412) && (frequency <= 2472)) |
1390 | return (frequency - 2407) / 5; | 1381 | return (frequency - 2407) / 5; |
1391 | if (frequency == 2484) | 1382 | if (frequency == 2484) |
1392 | return 14; | 1383 | return 14; |
1393 | if ((frequency >= 5000)&&(frequency <= 6100)) | 1384 | if ((frequency >= 5000) && (frequency <= 6100)) |
1394 | return (frequency - 5000) / 5; | 1385 | return (frequency - 5000) / 5; |
1395 | return -1; | 1386 | return -1; |
1396 | } | 1387 | } |
@@ -2191,4 +2182,5 @@ main (int argc, char *argv[]) | |||
2191 | return 1; /* we never exit 'normally' */ | 2182 | return 1; /* we never exit 'normally' */ |
2192 | } | 2183 | } |
2193 | 2184 | ||
2185 | |||
2194 | /* end of gnunet-helper-transport-wlan.c */ | 2186 | /* end of gnunet-helper-transport-wlan.c */ |