From 97c7f69c83b01481df07f27a01e7b4496d86fefc Mon Sep 17 00:00:00 2001 From: Malcolm Robb Date: Mon, 24 Feb 2014 10:28:35 +0000 Subject: [PATCH] Publish V1.08.2302.14 Final tidy up and publish --- coaa1090.obj | Bin 18164 -> 18336 bytes dump1090.c | 3 --- dump1090.h | 10 ++++---- makedump1090 | 2 +- makeppup1090 | 2 +- makeview1090 | 2 +- net_io.c | 67 ++++++++++++++++++++++++++------------------------- 7 files changed, 42 insertions(+), 44 deletions(-) diff --git a/coaa1090.obj b/coaa1090.obj index fcc4310faff5409845fc21389ab4d27f6300af1b..7e356319c62f76369e5e545358d2601967a37b8d 100644 GIT binary patch delta 5775 zcmX|_3wRa96~}jWH#fshfCK^w;T3Xo_Xffv2~T;0K!AV*1j<`4CJ2I%LZ}LsrC&i) zgBrRN@CzzpR1m7zfTaW}BE{5zAW{hh5fK%|Dk6R&59#^u9OV1%{qOIbnKS2{nY+8; z%9CQ_)1o5XT#>Un!!^rtSC3qR?}Po#D&dF3mq|^H;9o1!<4p{szDe~jBE^g&ENohx zX6IX?Y4yzbSypp5$uP`dtSy!_Fbpw0-Y^FHXPnlvPQ)38C1eY7TW0(@a$0tL3meAJ z+XBY8KS;x{?YKGfOASlLU4l=>pAAvS2XNghMv=`FifBE#k}fSfZVXK{>tT6n0h~|x zF_r91qc!4BkZZl&SS%!vk5CXhQB1*@up!Tr&2A>D0<`6Wl#Jb+QObU_n4Q9yAh*yc zJC!j}COCvG7?b4$D$7n|OqKs6^z4?*t>grh)QT}(euh|W7&GN_l)2rOF-y*dH=VJg z3|oX5Vml>khI3>?D#*?hZwA;+Zb#BCm()vkN75Yv^vrNyxdq%&ED1^+D3dWcNAwSH zi2MX;<%&@O4wJ7Tk36v_2%RtYBaa^9P=LebJIG^zSQQK|l&#Rq;bK#OlVlh;f^nMc z5HdW&9?5*K%!Rvvu}Jm;juMez@@!cKyo-yNCu2yuP#g;uE-@NBP8aqLXBj1*VDCmF z)G?%5qkCegahShHx5QT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&)Wt(_m^4$Me}^pi5uB8;(&rMt1|1Kf2PKA!Dv$w<@c^W7s5;JBXxG-tSG zW-8Ba8k2cKgJt+GtI-N?fwk0<8T%vY>!fX@|03-s{hkybf;cXQbQme#A84OVT1vW< zbPefml!jR+8M;Y(Nj2D5OoUHIRJ;#SL!^16#iX^Q>q)nh9wKce?Ii8?6rQZTWYFNn z1xt?QkS%mw2AbusPNEgB|V9n$k@lEpM~)P8n{S?tE4x{9tn?UOdv^P zP$5AADmG4bn>3C5W5}OP_8ih&^5>I3d_Otnkv>EL6%$pGF= 0; j--) { - if (Modes.clients[j]) { - Modes.maxfd = j; - break; - } + for (j = fd-1; j >= 0; j--) { + if (Modes.clients[j]) { + Modes.maxfd = j; + break; + } } } } @@ -191,7 +191,7 @@ void modesSendBeastOutput(struct modesMessage *mm) { char * pTimeStamp; char ch; int j; - int iOutLen = msgLen + 9; // Escape, message type, timestamp, sigLevel and msg + int iOutLen = msgLen + 9; // Escape, msgtype, timestamp, sigLevel, msg *p++ = 0x1a; if (msgLen == MODES_SHORT_MSG_BYTES) @@ -206,11 +206,11 @@ void modesSendBeastOutput(struct modesMessage *mm) { pTimeStamp = (char *) &mm->timestampMsg; for (j = 5; j >= 0; j--) { *p++ = (ch = pTimeStamp[j]); - if (0x1A == ch) {*p++ = ch; iOutLen++;} + if (0x1A == ch) {*p++ = ch; iOutLen++;} } *p++ = (ch = mm->signalLevel); - if (0x1A == ch) {*p++ = ch; iOutLen++;} + if (0x1A == ch) {*p++ = ch; iOutLen++;} for (j = 0; j < msgLen; j++) { *p++ = (ch = mm->msg[j]); @@ -368,10 +368,10 @@ void modesSendSBSOutput(struct modesMessage *mm) { // Field 19 is the Squawk Changing Alert flag (if we have it) if (mm->bFlags & MODES_ACFLAGS_FS_VALID) { if ((mm->fs >= 2) && (mm->fs <= 4)) { - p += sprintf(p, ",-1"); - } else { + p += sprintf(p, ",-1"); + } else { p += sprintf(p, ",0"); - } + } } else { p += sprintf(p, ","); } @@ -380,7 +380,7 @@ void modesSendSBSOutput(struct modesMessage *mm) { if (mm->bFlags & MODES_ACFLAGS_SQUAWK_VALID) { if ((mm->modeA == 0x7500) || (mm->modeA == 0x7600) || (mm->modeA == 0x7700)) { p += sprintf(p, ",-1"); - } else { + } else { p += sprintf(p, ",0"); } } else { @@ -390,10 +390,10 @@ void modesSendSBSOutput(struct modesMessage *mm) { // Field 21 is the Squawk Ident flag (if we have it) if (mm->bFlags & MODES_ACFLAGS_FS_VALID) { if ((mm->fs >= 4) && (mm->fs <= 5)) { - p += sprintf(p, ",-1"); - } else { + p += sprintf(p, ",-1"); + } else { p += sprintf(p, ",0"); - } + } } else { p += sprintf(p, ","); } @@ -424,17 +424,17 @@ void modesQueueOutput(struct modesMessage *mm) { //========================================================================= // // This function decodes a Beast binary format message -// +// // The message is passed to the higher level layers, so it feeds // the selected screen output, the network output and so forth. -// +// // If the message looks invalid it is silently discarded. // -// The function always returns 0 (success) to the caller as there is no +// The function always returns 0 (success) to the caller as there is no // case where we want broken messages here to close the client connection. // int decodeBinMessage(struct client *c, char *p) { - int msgLen = 0; + int msgLen = 0; int j; char ch; unsigned char msg[MODES_LONG_MSG_BYTES]; @@ -455,23 +455,24 @@ int decodeBinMessage(struct client *c, char *p) { // pass them off as being received by this instance when forwarding them mm.remote = 1; for (j = 0; j < 7; j++) { // Skip the message type and timestamp - ch = *p++; - if (0x1A == ch) {p++;} - } + ch = *p++; + if (0x1A == ch) {p++;} + } + mm.signalLevel = ch = *p++; // Grab the signal level if (0x1A == ch) {p++;} for (j = 0; j < msgLen; j++) { // and the data - msg[j] = ch = *p++; - if (0x1A == ch) {p++;} - } + msg[j] = ch = *p++; + if (0x1A == ch) {p++;} + } if (msgLen == MODEAC_MSG_BYTES) { // ModeA or ModeC - decodeModeAMessage(&mm, ((msg[0] << 8) | msg[1])); + decodeModeAMessage(&mm, ((msg[0] << 8) | msg[1])); } else { decodeModesMessage(&mm, msg); } - + useModesMessage(&mm); } return (0); @@ -850,7 +851,7 @@ void modesReadFromClient(struct client *c, char *sep, } // Have a 0x1a followed by 1, 2 or 3 - pass message less 0x1a to handler. if (handler(c, s)) { - modesFreeClient(c->fd); + modesFreeClient(c->fd); return; } fullmsg = 1; @@ -865,7 +866,7 @@ void modesReadFromClient(struct client *c, char *sep, // while ((e = strstr(s, sep)) != NULL) { // end of first message if found *e = '\0'; // The handler expects null terminated strings - if (handler(c, s)) { // Pass message to handler. + if (handler(c, s)) { // Pass message to handler. modesFreeClient(c->fd); // Handler returns 1 on error to signal we . return; // should close the client connection } @@ -873,8 +874,8 @@ void modesReadFromClient(struct client *c, char *sep, fullmsg = 1; } } - - if (fullmsg) { // We processed something - so + + if (fullmsg) { // We processed something - so c->buflen = &(c->buf[c->buflen]) - s; // Update the unprocessed buffer length memmove(c->buf, s, c->buflen); // Move what's remaining to the start of the buffer } else { // If no message was decoded process the next client