]> git.mxchange.org Git - flightgear.git/commitdiff
2000 17 Jan updates from "Oliver Delise" <delise@mail.isis.de>
authorcurt <curt>
Tue, 18 Jan 2000 18:28:51 +0000 (18:28 +0000)
committercurt <curt>
Tue, 18 Jan 2000 18:28:51 +0000 (18:28 +0000)
16 files changed:
src/NetworkOLK/FILES
src/NetworkOLK/README
src/NetworkOLK/Tools/FILES
src/NetworkOLK/Tools/HEADERS
src/NetworkOLK/Tools/Makefile
src/NetworkOLK/Tools/README
src/NetworkOLK/Tools/fgd.c
src/NetworkOLK/Tools/fgd.h
src/NetworkOLK/Tools/fgd_com.c
src/NetworkOLK/Tools/fgd_mcp.c
src/NetworkOLK/Tools/fgd_scan.c
src/NetworkOLK/fgd.h
src/NetworkOLK/net_hud.cxx
src/NetworkOLK/net_send.cxx
src/NetworkOLK/network.cxx
src/NetworkOLK/network.h

index 22437726728103a87e7e7ee117d3940990bf3d34..6bfd4c6ffdad10cf601d9d2d81b21d405daa0dcb 100644 (file)
@@ -3,7 +3,9 @@ README       - containing Network info
 Makefile.am  -  
 net_hud.cxx  - display found player's info in bottom/left part of HUD
 network.cxx  - initialization of netcode and vars
-network.h    - declaration of used vars and functions for libnetwork.a
-               should be included from other files using libnetwork
+fgd.h        - 
+network.h    - declaration of used vars and functions for libNetworkOLK.a
+               should be included from other files using libNetworkOLK
 net_send.cxx - communication with deamon
-Tools        - directory containing network tools and toys
+Tools        - directory containing the deamon, tools and toys necessairy
+               for testing the network with and without FGFS.
index a8db2a9a9f4b2c75d3039ca5f1ed236a080fa3ed..eb6a3e688cae7d489d05f2f745d091a8c775fe7d 100644 (file)
@@ -31,4 +31,4 @@ b) Runtime - setting the "int net_hud_display" variable to 0 disables any
    network display (default)
 
 Have Phun
-Oliver  <delise@rp-plus.de>
+Oliver  <delise@mail.isis.de>
index 13d08a4141905a447e1af088f03abc19ccc8c1ad..cef2f89eb514bdfff87e3bba66157a5abccdc7cc 100644 (file)
@@ -1,9 +1,11 @@
 FILES        - This file, describing the other files
 HEADERS      - Necessairy headers to compile the programs
-README       - Infos about programs
+INSTALL      - 
+README       - Detailed explanation about the programs and how to use
 Makefile     -  
 fgd.h        - Headerfile included by all programs
-fgd.c        - Flightgear deamon
+fgd.c        - Flightgear deamon, talkative, strongly recommended for start
+fgd_silent.c - Flightgear deamon with no debug output, for advanced users
 fgd_com.c    - Sends commandos to fgd
 fgd_scan.c   - Scanner to detect Flightgear deamons via TCP
 fgd_mcp.c    - Master Control Program for fgd
index 09b47436d0ca8b873af32e7bff65d7fddedbdea5..2f44fb8b702e10a287345a3bf84a855d0c8e04cd 100644 (file)
@@ -1,4 +1,4 @@
-Please check the presence of the following header files on your system
+These includes must be available on any Un*x, Windoze and Mac Donald's
 
 #include <stdio.h>
 #include <sys/socket.h>
@@ -8,4 +8,11 @@ Please check the presence of the following header files on your system
 #include <netdb.h>
 #include <sys/time.h>
 #include <fcntl.h>
-#include <sys/utsname.h>
\ No newline at end of file
+#include <sys/utsname.h>
+
+Please look also into *all* your systemwide "socket.h" and the header
+files (mainly in /usr/include/sys or krnl-src) included by them for 
+declarations like "MSG_PEEK" etc.
+In case of missing MSG_foo declarations please contact me:
+
+Oliver Delise  <delise@mail.isis.de>
index 1c7461f816896235a776acc066787018cd25e705..f23e8d371f55f0a9ac9f97dc55ec027d53b3f2ab 100644 (file)
@@ -2,7 +2,7 @@ CPPFLAGS        =
 CFLAGS         =
 CC             = gcc
 RM             = rm
-PROGS          = fgd fgd_scan fgd_com fgd_mcp fgd_verbose
+PROGS          = fgd fgd_scan fgd_com fgd_mcp fgd_silent
 BINDIR         = /usr/local/bin
 
 all: $(PROGS)
@@ -10,7 +10,7 @@ all: $(PROGS)
 fgd:      fgd.c
          $(CC) -o $@ $^
 
-fgd_verbose: fgd_verbose.c
+fgd_silent: fgd_silent.c
          $(CC) -o $@ $^
 
 fgd_scan: fgd_scan.c
index df6d29f05d26ec19717ac9e6a3a45e9e28e06a9f..d4d646cd46706ad38e8fb2d7e7527dcf6e7c18f8 100644 (file)
@@ -1,7 +1,7 @@
 Welcome to FlightGear Deamon fgd
 --------------------------------
 Here the first Tools to play with FlightGear Deamon.
-This is yet alpha and the sources remain to be tidied up,
+This is yet alpha moving to beta and the sources remain to be tidied up,
 and to get documented.
 
 
@@ -242,6 +242,8 @@ History:
                  Nov 29 1999 -> Implementing scenario functions like virtual
                                 Pilots
                  Nov 30 1999 -> ???
+  v0.1-beta    : Jan 16 2000 -> Several libc5, glibc-2.0 and glibc-2.1
+                                issues cleaned up
 
 
 Future Plans:
@@ -284,4 +286,4 @@ You can do whatever you want with this software, even enhance it.
 
 Send comments/flames/BEER/whatever to delise@mail.isis.de
 
-Oliver Delise Nov/08/99
+Oliver Delise Jan/16/00
index a41b93395062df2140cbeca7bec63bc5ae93631f..66a744fd7b23d473a6dd36dfe24ae53ca63f062f 100644 (file)
@@ -2,10 +2,9 @@
 /* FGD.C by Oliver Delise                                    */
 /* Contact info:                                             */
 /* e-mail: delise@mail.isis.de                               */
-/* www: http://www.isis.de/members/~odelise/progs/mmx-emu/   */
-/* ftp: http://www.isis.de/members/~odelise/progs/flightgear */
+/* www: http://www.isis.de/members/odelise/progs/flightgear  */
 /*                                                           */
-/* Version 0.1-alpha                                         */
+/* Version 0.1-beta                                          */
 /* The author of this program offers no waranty at all       */
 /* about the correct execution of this software material.    */
 /* Furthermore, the author can NOT be held responsible for   */
@@ -28,6 +27,8 @@
 /*                                                           */
 /*    History: v0.1pre-alpha: May 25 1999 -> First release   */
 /*             v0.1-alpha   : Nov 08 1999                    */
+/*             v0.1-beta    : Jan 16 2000                    */
+/*                            libc5, glibc-2.0, 2.1 cleanups */
 /*************************************************************/
 
 
@@ -41,7 +42,7 @@
 #include <fcntl.h>
 #include <sys/utsname.h>
 
-#define printf //
+//#define printf //
 
 /* Net-stuff */
 fd_set rset, allset;
@@ -217,7 +218,7 @@ int fgd_ele_len;
 struct sockaddr_in address;
 struct sockaddr_in my_address;
 int result;
-extern char *sys_errlist[];
+
 extern int errno;
 int current_port = 0; 
 u_short base_port = 0;
@@ -301,6 +302,7 @@ struct { char *ip, *lon, *lat, *alt;} fg_id;
     if (1 == 1) {
     if ( bind(sock, (struct sockaddr *)&address, sizeof(address)) == -1) {
          printf(" Aiiiieeehh...ADRESS ALSO IN USE...\7hmmm...please check another port\n");
+         printf(" Just wait a few seconds or do a netstat to see the port status.\n");
          exit(-1);
     }
     listen(sock, 5);
@@ -449,10 +451,12 @@ for (;;){
                     }
                     else strcpy( fgd_client.adr, "UNKNOWN");
       /* writing answer back to client */
-                sprintf( (char*) buff, "%s %s", "FGD", fgd_client.adr);
-                buff[3] = strlen(fgd_client.adr);
+                sprintf( (char*) buff, "%sLH%s ", "FGD", fgd_client.adr);
+                buff[3] = strlen(fgd_client.adr) + 1;
+                buff[4] = 0;
+                buff[ buff[3] + 4] = 0;
                 printf("    IP : %s\n", fgd_client.adr);
-                write( my_sock, &buff, buff[3]+4);
+                write( my_sock, &buff, buff[3]+5);
 //                     close(my_sock);
                break;
       case 17: printf(" fgd   : Get Mat4 DATA from client\n");
@@ -500,7 +504,7 @@ for (;;){
                 sprintf( (char*) buff, "%s %s", "FGD", fgd_client.adr);
                 buff[3] = 0;
                 fgd_cnt = 0;
-                fgd_curpos = 5;
+                fgd_curpos = 6;
                test = head->next;
                while (test != tail) { 
                   printf("    IP : %-16s  Callsign : %-16s\n", test->ipadr, test->callsign);
@@ -533,7 +537,8 @@ for (;;){
                if (fgd_cnt == 0) fgd_curpos --;
                printf(" ele_len %d  curpos %d\n", fgd_ele_len, fgd_curpos);
                buff[3] = fgd_curpos;
-               buff[4] = fgd_cnt;
+               buff[4] = fgd_curpos / 256;
+               buff[5] = fgd_cnt;
                write( my_sock, &buff, fgd_curpos);
 //                     close(my_sock);
                break;
@@ -596,10 +601,19 @@ for (;;){
                     }
                     else strcpy( fgd_client.adr, "UNKNOWN");
       /* writing answer back to client */
-                sprintf( (char*) buff, "%s %s", "FGD", fgd_client.adr);
-                buff[3] = strlen(fgd_client.adr);
+                sprintf( (char*) buff, "FGDLH%s", fgd_client.adr);
+                buff[3] = strlen(fgd_client.adr) + 1;
+                buff[4] = buff[buff[3]+5] = 0;
                 printf("    IP : %s\n", fgd_client.adr);
-                write( my_sock, &buff, buff[3]+4);
+                write( my_sock, &buff, buff[3]+5);                    
+//  Just leaving the old stuff in, to correct it for FGFS later...
+//  I'm sick of this f$%&ing libc5/glibc2.0/2.1 quirks
+//  Oliver...very angry...
+//      /* writing answer back to client */
+//                sprintf( (char*) buff, "%s %s", "FGD", fgd_client.adr);
+//                buff[3] = strlen(fgd_client.adr);
+//                printf("    IP : %s\n", fgd_client.adr);
+//                write( my_sock, &buff, buff[3]+4);
 //                close(my_sock);
                break;  
       case 9:  printf(" fgd   : Shutdown\n");
index a1cbb766ba178949e7d79f20dfbf9e09b95ad88d..ceedb5a74240268bf77354ff063fd7bb8a867f98 100644 (file)
@@ -6,3 +6,14 @@
 #include <sys/time.h>
 #include <fcntl.h>
 #include <sys/utsname.h>
+
+/* this seems to be missing for glibc-2.0.x */
+/* libc5 & glibc-2.1 do have them           */
+#ifndef MSG_PEEK
+int     MSG_PEEK        = 0x02;    /* Peek at incoming messages.  */
+#define MSG_PEEK        MSG_PEEK
+#endif
+#ifndef MSG_WAITALL
+int     MSG_WAITALL     = 0x100;   /* Wait for a full request.  */
+#define MSG_WAITALL     MSG_WAITALL
+#endif
index 276d98f560030b2e927a9a6c5ea41c120109a158..1f6424ce074ba775971b91104d594629660731b5 100644 (file)
@@ -1,34 +1,35 @@
-/***********************************************************/
-/* FGD_COM.C by Oliver Delise                              */
-/* Contact info:                                           */
-/* e-mail: delise@mail-isis.de                             */
-/* www: http://www.online-club.de/~olk/progs/mmx-emu/      */
-/* ftp: http://www.online-club.de/~olk/progs/flightgear    */ 
-/*                                                         */
-/* Version 0.1-alpha                                       */
-/* The author of this program offers no waranty at all     */
-/* about the correct execution of this software material.  */
-/* Furthermore, the author can NOT be held responsible for */
-/* any physical or moral damage caused by the use of this  */
-/* software.                                               */
-/*                                                         */
-/* This is a standalone Tool to communicate with any       */
-/* FlightGear-Deamon.                                      */
-/* This is Open Source Software with many parts            */
-/* shamelessly stolen from others...                       */
-/*                                                         */
-/* -> This program will use a TCP port listening on a      */
-/*    remote or local host inside the range you give to it.*/
-/*    I offer no warranty over the accuracy though :)      */
-/*    There are 3 verbose modes: No info, service info, and*/
-/*    full info. No info is good of you only want the list */
-/*    of the ports, no more info. The best mode is Full    */
-/*    info, as you get error information,etc. The main     */
-/*    output is STDOUT, and ALL the errors go to STDERR.   */
-/*                                                         */
-/*    History: v0.1pre-alpha: May 25 1999 -> First release */
-/*             v0.1-alpha     Nov 08 1999                  */
-/***********************************************************/
+/*************************************************************/
+/* FGD_COM.C by Oliver Delise                                */
+/* Contact info:                                             */
+/* e-mail: delise@mail-isis.de                               */
+/* www: http://www.isis.de/members/odelise/progs/flightgear  */
+/*                                                           */
+/* Version 0.1-beta                                          */
+/* The author of this program offers no waranty at all       */
+/* about the correct execution of this software material.    */
+/* Furthermore, the author can NOT be held responsible for   */
+/* any physical or moral damage caused by the use of this    */
+/* software.                                                 */
+/*                                                           */
+/* This is a standalone Tool to communicate with any         */
+/* FlightGear-Deamon.                                        */
+/* This is Open Source Software with many parts              */
+/* shamelessly stolen from others...                         */
+/*                                                           */
+/* -> This program will use a TCP port listening on a        */
+/*    remote or local host inside the range you give to it.  */
+/*    I offer no warranty over the accuracy though :)        */
+/*    There are 3 verbose modes: No info, service info, and  */
+/*    full info. No info is good of you only want the list   */
+/*    of the ports, no more info. The best mode is Full      */
+/*    info, as you get error information,etc. The main       */
+/*    output is STDOUT, and ALL the errors go to STDERR.     */
+/*                                                           */
+/*    History: v0.1pre-alpha: May 25 1999 -> First release   */
+/*             v0.1-alpha     Nov 08 1999                    */
+/*             v0.1-beta      Jan 16 2000 -> libc5/glibc-2.0 */
+/*                            glibc2.1 cleanups              */
+/*************************************************************/
 
 #include <stdio.h>
 #include <sys/socket.h>
@@ -47,7 +48,6 @@ int my_sock;
 struct sockaddr_in address;
 struct sockaddr_in my_address;
 int result;
-extern char *sys_errlist[];
 extern int errno;
 int current_port = 0; 
 u_short base_port = 0;
index e3466aa19334da666d9249a0a10cff70990f58a9..2ab5f4517f2cd7e3eb50d80cb7e732453e3eb2ae 100644 (file)
@@ -2,10 +2,9 @@
 /* FGD_MCP.C by Oliver Delise                                */
 /* Contact info:                                             */
 /* e-mail: delise@mail.isis.de                               */
-/* www: http://www.isis.de/members/~odelise/progs/mmx-emu/   */
-/* ftp: http://www.isis.de/members/~odelise/progs/flightgear */
+/* www: http://www.isis.de/members/odelise/progs/flightgear  */
 /*                                                           */
-/* Version 0.1-alpha                                         */
+/* Version 0.1-beta                                          */
 /* The author of this program offers no waranty at all       */
 /* about the correct execution of this software material.    */
 /* Furthermore, the author can NOT be held responsible for   */
 /*                                                           */
 /*    History: v0.1pre-alpha: May 25 1999 -> First release   */
 /*             v0.1-alpha     Nov 11 1999                    */
+/*             v0.1-beta      Jan 16 2000 libc5/glibc-2.0    */
+/*                                        glibc-2.1 cleanups */
 /*************************************************************/
 
 #include <stdio.h>
 #include "fgd.h"
+#include <math.h>
 
 //#define printf //
 
@@ -41,7 +43,6 @@ int my_sock;
 struct sockaddr_in address;
 struct sockaddr_in my_address;
 int result;
-extern char *sys_errlist[];
 extern int errno;
 int current_port  = 10000; 
 u_short base_port = 10000;
@@ -197,7 +198,7 @@ void fgd_init(void){
    address.sin_family = AF_INET;
 /* determinating the source/sending host */
    if (uname(&myname) == 0) strcpy(src_host , myname.nodename);   
-   printf("MCP: I'm running on HOST : %s  ", src_host);
+   printf("MCP: I'm running on HOST : %s   ", src_host);
    if (host_info = gethostbyname( src_host)) {
      bcopy(host_info->h_addr, (char *)&address.sin_addr,host_info->h_length);
      strcpy((char *) fgd_mcp_ip, (char *) inet_ntoa(address.sin_addr));
@@ -209,17 +210,19 @@ void fgd_init(void){
      bcopy(host_info->h_addr, (char *)&address.sin_addr,host_info->h_length);
      strcpy((char *) fgd_ip, (char *) inet_ntoa(address.sin_addr));
      if (verbose == 2) {
-            printf(" resolved\n     FGD running on HOST : %s", fgd_host);
-            printf("   IP : %s\n", fgd_ip);
-            }
+        printf(" resolved\n     FGD running on HOST : %s", fgd_host);
+        printf("   IP : %s\n", fgd_ip);
+     }
    } else if ((address.sin_addr.s_addr = inet_addr( fgd_host)) == INADDR_NONE) {
-            fprintf(stderr,"   Could not get %s host entry !\n", fgd_host);
             printf(" NOT resolved !!!\n");
-            exit(1);
+            printf("MCP: Could not get %s host entry !\n", fgd_host);
+            printf("MCP: Enter '10' for deamon IP or fqdn or alias. (your choice)\n");
+//          exit(1);
           } else if (verbose == 2) printf(" address valid\n");
    
    if ((base_port > end_port) || ((short)base_port < 0)) { 
-     fprintf(stderr,"Bad port range : start=%d end=%d !\n");
+            printf("MCP: Bad port range : start=%d end=%d !\n");
+            printf("MCP: Enter '10' for deamon IP/fqdn\n");     
      exit(1);
    } else if (verbose == 2) {
             printf("     Port range: %d to %d\n",base_port,end_port);
@@ -319,10 +322,10 @@ void fgd_send_com( char *FGD_com, char *FGFS_host) {
 
 /* The Receiving Part, fgd returns errormessages, succes, etc... */
                   do { 
-                     fgd_status = recv( sock, (char *) buffp, 4, MSG_WAITALL);
+                     fgd_status = recv( sock, (char *) buffp, 5, MSG_WAITALL);
                      printf("     status %d\n", fgd_status);
                      }
-//                  while ( (fgd_status != 4) && (fgd_status != 0) );
+//                  while ( (fgd_status != 5) && (fgd_status != 0) );
                   while ( (fgd_status == -1) || (fgd_status == -1) );
                   if (verbose == 2) {
                       printf("     Got reply : %x %x %x\n", buffp[0], buffp[1], buffp[2]);
@@ -337,15 +340,17 @@ void fgd_send_com( char *FGD_com, char *FGFS_host) {
                       case  1: printf("FGD: Registering Host %s\n", FGFS_host);
                                break;
                       case  2: printf("FGD: Showing registered Hosts at %s\n", fgd_host);
-                               if (buffp[3] != 4) {
-/* FIXME: replace with SELECT to avoid broken pipes, known bug (-; */
+                               printf(" %d %d\n", buffp[3], buffp[4]);
+                               if ( (buffp[3] + 256 * buffp[4]) != 5 ) {
+/* FIXME: replace with SELECT to avoid broken pipes, known bug (-;       */
+/*        but the transfer is calculated very accurately, null problemo  */
                   do { 
-                    fgd_status = recv( sock, fgd_txt, buffp[3]-4, MSG_WAITALL);
+                      fgd_status = recv( sock, fgd_txt, buffp[3]-5, MSG_WAITALL);
 //                    printf("     status %d\n", fgd_status);
                      }
 //                  while ( (fgd_status != 4) && (fgd_status != 0) );
                   while ( (fgd_status == -1) || (fgd_status == -1) );                               
-//                                 read( sock, fgd_txt, buffp[3]-4);
+//                                 read( sock, fgd_txt, buffp[3]-5);
                                  fgd_curpos = 2;
                                  for (fgd_cnt = 1; fgd_cnt < (fgd_txt[0]+1); fgd_cnt++) {
                                    fgd_ele_len = fgd_txt[fgd_curpos-1];
@@ -355,27 +360,26 @@ void fgd_send_com( char *FGD_com, char *FGFS_host) {
                                    printf("     #%d  %s\n", fgd_cnt, fgfs_host);
                                  }
                                }
-                                 
                                break;
                       case  5: printf("FGD: Receiving data from Host %s\n", FGFS_host);
-                               read( sock, fgd_txt, buffp[3]);
+                               read( sock, fgd_txt, (unsigned char) buffp[3] + 256 * (unsigned char) buffp[4]);
                                fgd_txt[buffp[3]] = 0;
-                               if (strcmp(fgd_txt, "UNKNOWN") == -1) {
-                                   printf("FGD: Data from Host %s received\n", fgd_txt);
-                                   }
-                                   else printf("FGD: Host not in list, sorry...\n");
+                               if (strcmp(fgd_txt, "UNKNOWN") == 0) {
+                                   printf("FGD: Host not in list, sorry...\n");                               
+                               }
+                               else printf("FGD: Data from Host %s received\n", fgd_txt);
                                break;
                       case  6: printf("FGD: Sending data to Host %s\n", FGFS_host);
-                               if (buffp[3] != 4) {
+                               if (buffp[3] != 5) {
 /* FIXME: replace with SELECT */
-                  if (verbose == 2) printf("Noch %d bytes\n", (unsigned char) buffp[3]);
+                  if (verbose == 2) printf("Noch %d bytes\n", (unsigned char) buffp[3] + 256 * (unsigned char) buffp[4]);
                   do { 
-                    fgd_status = recv( sock, fgd_txt, (unsigned char) buffp[3]-4, MSG_PEEK);
+                    fgd_status = recv( sock, fgd_txt, (unsigned char) buffp[3]-5, MSG_PEEK);
                     if (verbose == 2) printf("Status %d\n", fgd_status);
                      }
-                    while ( (fgd_status == 4) || (fgd_status == -1) );
+                    while ( (fgd_status == 5) || (fgd_status == -1) );
 //                  while ( (fgd_status == -1) || (fgd_status == -1) );                               
-                                 read( sock, fgd_txt, buffp[3]-4);
+                                 read( sock, fgd_txt, buffp[3]-5);
                                  fgd_curpos = 2;
                                  fgd_ppl_old = fgd_ppl;
                                  fgd_ppl = fgd_txt[0];
@@ -432,10 +436,10 @@ void fgd_send_com( char *FGD_com, char *FGFS_host) {
                       case  8: printf("FGD: Unregistering Host %s\n", FGFS_host);
                                read( sock, fgd_txt, buffp[3]);
                                fgd_txt[buffp[3]] = 0;
-                               if (strcmp(fgd_txt, "UNKNOWN") == -1) {
-                                   printf("FGD: Host %s unregistered\n", fgd_txt);
+                               if (strcmp(fgd_txt, "UNKNOWN") == 0) {
+                                   printf("FGD: Host not in list, sorry...\n");
                                    }
-                                   else printf("FGD: Host not in list, sorry...\n");
+                                   else printf("FGD: Host %s unregistered\n", fgd_txt);
                                break;                               
                       case  9: printf(" Shutdown FlightGear-Deamon %s .\n", fgd_name);
                                break;                               
@@ -457,13 +461,13 @@ int main(int argc, char **argv) {
    fgd_init();
    for ( ; (atoi( (char*) fgd_job)) != 99;){
    printf("MCP: ready...enter commando (42 help) ");
-   gets((char *) fgd_job);
-   if (verbose == 2) printf("MCP: got %s %d\n", (char *) fgd_job, strlen((char *) fgd_job));
-   if ( strcmp( fgd_job, "") > 0 ) switch( atoi((char*) fgd_job)) {
-     case  0 : if ( strcmp( (char *) fgd_job, "0") == 0 ){
+   fgets((char *) fgd_job, 5, stdin);
+//   if (verbose == 2) printf("MCP: got %s %d\n", (char *) fgd_job, strlen((char *) fgd_job));
+   if ( strcmp( fgd_job, "\n") > 0 ) switch( atoi((char*) fgd_job)) {
+     case  0 : if ( strncmp( (char *) fgd_job, "0", 1) == 0 ){
                   printf("MCP: Scan for fgd\n");
                   fgd_send_com( "0", src_host);
-                  }
+               }
                break;
      case  1 : printf("MCP: Register to fgd\n");
                fgd_send_com( "1", src_host);
@@ -491,33 +495,39 @@ int main(int argc, char **argv) {
                printf("     Deamon          Host            IP              Port\n");
                printf("     %-16s%-16s%-16s%-16d\n", fgd_name, fgd_host, fgd_ip, base_port);
                printf("\n     Enter new Host:[%s]  ", fgd_host);
-               gets((char *) fgd_txt);
-               if ( strlen(fgd_txt) != 0 ) {
+               fgets((char *) fgd_txt, 32, stdin);
+               if ( strlen(fgd_txt) != 1 ) {
                    strcpy(fgd_host, fgd_txt);
+                   fgd_host[ strlen( fgd_txt) - 1] = 0;
                    if (host_info = gethostbyname( fgd_host)) {
                        bcopy(host_info->h_addr, (char *)&address.sin_addr,host_info->h_length);
                        strcpy((char *) fgd_ip, (char *) inet_ntoa(address.sin_addr));
                        if (verbose == 2) {
-                           printf(" resolved\n     FGD running on HOST : %s", fgd_host);
+                           printf("MCP: Resolved...FGD running on HOST : %s", fgd_host);
                            printf("   IP : %s\n", fgd_ip);
                        }
                    } else if ((address.sin_addr.s_addr = inet_addr( fgd_host)) == INADDR_NONE) {
-                              fprintf(stderr,"   Could not get %s host entry !\n", fgd_host);
-                              printf(" NOT resolved !!!\n");
-                              exit(1);
+                              fprintf(stderr,"MCP: Could not get %s host entry !\n", fgd_host);
+                              printf("     NOT resolved !!!\n");
+//                            exit(1);
                           } else if (verbose == 2) printf(" address valid\n");
                }
                break;
      case 11 : printf("MCP: Choose default deamon Port:\n");
                printf("     Deamon          Host            IP              Port\n");
                printf("     %-16s%-16s%-16s%-16d\n", fgd_name, fgd_host, fgd_ip, base_port);
-               printf("     Enter new Port: ");
-               gets((char *) buffp);
+               printf("     Enter new Port:[%d] ", base_port);
+               fgets((char *) buffp, 16, stdin);
                current_port = atoi((char*) buffp);
+               if (current_port < 1025) {
+                   printf("MCP: Be fair please...Ports below 1024 are not a good choice\n");
+                   current_port = base_port;
+                   break;
+               }
                if (current_port != 0) {
                    base_port = atoi((char*) buffp);
                    end_port = base_port;
-                   }
+               }
                break;               
      case 20 : printf("MCP: Current values:\n");
                printf("     Deamon          Host            IP              Port\n");
@@ -543,7 +553,8 @@ int main(int argc, char **argv) {
                
                break;               
      case 21 : printf("MCP: Enter your callsign, Pilot ");
-               gets((char *) fgd_callsign);     
+               fgets((char *) fgd_callsign, 32, stdin);
+               fgd_callsign[ strlen(fgd_callsign) - 1 ] = 0;
                break;
      case 42 : printf("MCP: Commands available:\n 0   Scan for fgd\n 1   Register\n");
                printf(" 2   Show registered\n 3   Send MSG\n 4   Send MSG to ALL\n");
@@ -551,7 +562,7 @@ int main(int argc, char **argv) {
                printf(" 8   Unregister from fgd\n 9   Shutdown fgd\n");
                printf("10   Set deamon HOST\n11   Set deamon PORT\n");
                printf("20   Show values\n21   Set own callsign\n");
-               printf("31   Set deamon PORT\n");
+//               printf("31   Set deamon PORT\n");
                printf("98   Stress test\n");
                printf("99   Quit Master Control Program (not recommended)\n");
                break;
@@ -566,14 +577,16 @@ int main(int argc, char **argv) {
                  fgd_send_com( "5", src_host);
                  fgd_send_com( "6", src_host);
                  printf("other lat:%7.3f  boss lat:%7.3f\n", other->latf, boss->latf);
-                 if (fabs(boss->latf - other->latf) > 0.001) {
+                 if (fabs( (double) boss->latf - (double) other->latf ) > 0.001) {
                    printf("other lat:%7.3f  boss lat:%7.3f\n", other->latf, boss->latf);
                    fgd_loss++;
                  }
                }
                printf(" Packets lost: %d\n", fgd_loss);
                break;
-     default:  break;
+     case 99 : printf("MCP: Good bye...\n");
+               break;
+     default:  printf("MCP: ???\n");
      }
    }
    // fgd_send_com( argv[5], argv[6]);
@@ -588,6 +601,5 @@ int main(int argc, char **argv) {
    free(fgfs_pilot);
    free(src_host);
    free(fgd_txt);
-   printf("MCP: Exit...\n");
    exit(0);
 }
index 25f617cf1048d3e731a05cb41ba1687a9cb69301..7f301bfad3802cab1824371f145a86fb191f3f09 100644 (file)
@@ -1,34 +1,35 @@
-/***********************************************************/
-/* FGD_SCAN.C by Oliver Delise                             */
-/* Contact info:                                           */
-/* e-mail: delise@mail-isis.de                             */
-/* www: http://www.online-club.de/~olk/progs/mmx-emu/      */
-/* ftp: http://www.online-club.de/~olk/progs/flightgear    */ 
-/*                                                         */
-/* Version 0.1-alpha                                       */
-/* The author of this program offers no waranty at all     */
-/* about the correct execution of this software material.  */
-/* Furthermore, the author can NOT be held responsible for */
-/* any physical or moral damage caused by the use of this  */
-/* software.                                               */
-/*                                                         */
-/* This is a standalone Tool to scan for any FlightGear    */
-/* Deamon.                                                 */
-/* This is Open Source Software with many parts            */
-/* shamelessly stolen from others...                       */
-/*                                                         */
-/* -> This program will scan for TCP port listening on a   */
-/*    remote or local host inside the range you give to it.*/
-/*    I offer no warranty over the accuracy though :)      */
-/*    There are 3 verbose modes: No info, service info, and*/
-/*    full info. No info is good of you only want the list */
-/*    of the ports, no more info. The best mode is Full    */
-/*    info, as you get error information,etc. The main     */
-/*    output is STDOUT, and ALL the errors go to STDERR.   */
-/*                                                         */
-/*    History: v0.1pre-alpha: May 25 1999 -> First release */
-/*             v0.1-alpha     Nov 08 1999                  */
-/***********************************************************/
+/*************************************************************/
+/* FGD_SCAN.C by Oliver Delise                               */
+/* Contact info:                                             */
+/* e-mail: delise@mail-isis.de                               */
+/* www: http://www.isis.de/members/odelise/progs/flightgear  */
+/*                                                           */
+/* Version 0.1-beta                                          */
+/* The author of this program offers no waranty at all       */
+/* about the correct execution of this software material.    */
+/* Furthermore, the author can NOT be held responsible for   */
+/* any physical or moral damage caused by the use of this    */
+/* software.                                                 */
+/*                                                           */
+/* This is a standalone Tool to scan for any FlightGear      */
+/* Deamon.                                                   */
+/* This is Open Source Software with many parts              */
+/* shamelessly stolen from others...                         */
+/*                                                           */
+/* -> This program will scan for TCP port listening on a     */
+/*    remote or local host inside the range you give to it.  */
+/*    I offer no warranty over the accuracy though :)        */
+/*    There are 3 verbose modes: No info, service info, and  */
+/*    full info. No info is good of you only want the list   */
+/*    of the ports, no more info. The best mode is Full      */
+/*    info, as you get error information,etc. The main       */
+/*    output is STDOUT, and ALL the errors go to STDERR.     */
+/*                                                           */
+/*    History: v0.1pre-alpha: May 25 1999 -> First release   */
+/*             v0.1-alpha     Nov 08 1999                    */
+/*             v0.1-beta      Jan 16 2000 libc5/glibc-2.0    */
+/*                                        glibc-2.1 cleanups */
+/*************************************************************/
 
 
 #include <stdio.h>
@@ -47,7 +48,6 @@ int my_sock;
 struct sockaddr_in address;
 struct sockaddr_in my_address;
 int result;
-extern char *sys_errlist[];
 extern int errno;
 int current_port  = 20000; 
 u_short base_port = 20000;
index c25d2b521f2497f09446caa9f916a3addf947736..ceedb5a74240268bf77354ff063fd7bb8a867f98 100644 (file)
@@ -5,4 +5,15 @@
 #include <netdb.h>
 #include <sys/time.h>
 #include <fcntl.h>
-#include <sys/utsname.h>
\ No newline at end of file
+#include <sys/utsname.h>
+
+/* this seems to be missing for glibc-2.0.x */
+/* libc5 & glibc-2.1 do have them           */
+#ifndef MSG_PEEK
+int     MSG_PEEK        = 0x02;    /* Peek at incoming messages.  */
+#define MSG_PEEK        MSG_PEEK
+#endif
+#ifndef MSG_WAITALL
+int     MSG_WAITALL     = 0x100;   /* Wait for a full request.  */
+#define MSG_WAITALL     MSG_WAITALL
+#endif
index 89aabafd8bccc3f404639434e43778f6d06b5da4..bee19df932a1cc3dc3aadc4ccaa1546bc22c9e14 100644 (file)
@@ -2,7 +2,7 @@
 //
 // Written by Oliver Delise, started May 1999.
 //
-// Copyleft (C) 1999  Oliver Delise - delise@rp-plus.de
+// Copyleft (C) 1999  Oliver Delise - delise@mail.isis.de
 //
 // This program is free software; you can redistribute it and/or
 // modify it under the terms of the GNU General Public License as
index d6e2ca296748311bbe92c59a7e75791ef993d906..ba7a78781912d7d046764b5fadfcb85bc390f48a 100644 (file)
@@ -1,11 +1,10 @@
 /*************************************************************/
-/* FGD_MCP.C by Oliver Delise                                */
+/* NET_SEND.CXX by Oliver Delise                             */
 /* Contact info:                                             */
 /* e-mail: delise@mail.isis.de                               */
-/* www: http://www.isis.de/members/~odelise/progs/mmx-emu/   */
-/* ftp: http://www.isis.de/members/~odelise/progs/flightgear */
+/* www: http://www.isis.de/members/odelise/progs/flightgear  */
 /*                                                           */
-/* Version 0.1-alpha                                         */
+/* Version 0.1-beta                                          */
 /* The author of this program offers no waranty at all       */
 /* about the correct execution of this software material.    */
 /* Furthermore, the author can NOT be held responsible for   */
@@ -28,6 +27,8 @@
 /*                                                           */
 /*    History: v0.1pre-alpha: May 25 1999 -> First release   */
 /*             v0.1-alpha     Nov 11 1999                    */
+/*             v0.1-beta      Jan 16 2000 -> libc5, glibc2.0 */
+/*                            glibc-2.1 issues fixed         */
 /*************************************************************/
 
 #include <stdio.h>
@@ -256,12 +257,12 @@ void fgd_init(void){
    } else if ((address.sin_addr.s_addr = inet_addr( fgd_host)) == INADDR_NONE) {
             fprintf(stderr,"   Could not get %s host entry !\n", fgd_host);
             printf(" NOT resolved !!!\n");
-            exit(1);
+            // exit(1);
           } else if (verbose == 2) printf(" address valid\n");
    
    if ((base_port > end_port) || ((short)base_port < 0)) { 
      fprintf(stderr,"Bad port range : start=%d end=%d !\n");
-     exit(1);
+   // exit(1);
    } else if (verbose == 2) {
             printf("     Port range: %d to %d\n",base_port,end_port);
             }
@@ -314,7 +315,8 @@ void fgd_send_com( char *FGD_com, char *FGFS_host) {
     if (sock == -1)
      {
        fprintf(stderr, "Error assigning master socket: %s\n",sys_errlist[errno]);
-       exit(-1);
+        /* must check how severe this really is */
+       // exit(-1);
      } 
 
     address.sin_port = htons(current_port);
@@ -416,7 +418,8 @@ void fgd_send_com( char *FGD_com, char *FGFS_host) {
         } 
     }  else if (errno == 113) {
          fprintf(stderr,"No route to host !\n");
-         exit(1);
+         /* must check this */
+         // exit(1);
        } 
 /*     fprintf(stderr,"Error %d connecting socket %d to port %d: %s\n",
                 errno,sock,current_port,sys_errlist[errno]); */ 
@@ -473,10 +476,18 @@ void fgd_send_com( char *FGD_com, char *FGFS_host) {
                       case  5: printf("FGD: Receiving data from Host %s\n", FGFS_host);
                                read( sock, fgd_txt, buffp[3]);
                                fgd_txt[buffp[3]] = 0;
+/* This works...
+                               if (strcmp(fgd_txt, "UNKNOWN") == 0) {
+                                   printf("FGD: Host not in list, sorry...\n");
+                               }
+                               else printf("FGD: Data from Host %s received\n", fgd_txt);
+*/
+/* This has problem with glibc-2.1
                                if (strcmp(fgd_txt, "UNKNOWN") == -1) {
                                    if (verbose == 2) printf("FGD: Data from Host %s received\n", fgd_txt);
                                    }
                                    else if (verbose == 2) printf("FGD: Host not in list, sorry...\n");
+*/
                                break;
                       case 17: if (verbose == 2) printf("FGD: Receiving Mat4 data from Host %s\n", FGFS_host);
                                read( sock, fgd_txt, fgd_reply_len);
@@ -634,11 +645,18 @@ void fgd_send_com( char *FGD_com, char *FGFS_host) {
                                   test = test->next;
                                }
                                fgd_ppl = 0;
-/*
+/*  This does...
+                               if (strcmp(fgd_txt, "UNKNOWN") == 0) {
+                                   printf("FGD: Host not in list, sorry...\n");
+                               }
+                               else printf("FGD: Host %s unregistered\n", fgd_txt);
+*/
+/*  This does not work on glibc-2.1
                                if (strcmp(fgd_txt, "UNKNOWN") == -1) {
                                    printf("FGD: Host %s unregistered\n", fgd_txt);
                                    }
-                                   else printf("FGD: Host not in list, sorry...\n"); */
+                               else printf("FGD: Host not in list, sorry...\n"); 
+*/
                                break;                               
                       case  9: printf(" Shutdown FlightGear-Deamon %s .\n", fgd_name);
                                break;                               
index 845bed907887c610e74b90165a6728ef8820e7ba..b5e985486110c305f583674a5e740f883e143760 100644 (file)
@@ -2,7 +2,7 @@
 //
 // Written by Oliver Delise, started May 1999.
 //
-// Copyleft (C) 1999  Oliver Delise - delise@rp-plus.de
+// Copyleft (C) 1999  Oliver Delise - delise@mail.isis.de
 //
 // This program is free software; you can redistribute it and/or
 // modify it under the terms of the GNU General Public License as
index 7c4a84a2af6cf75158439ffbe7aeff47ea098809..69897f925f591433418fd8670b3efa0428b0da12 100644 (file)
@@ -2,7 +2,7 @@
 //
 // Written by Oliver Delise, started May 1999.
 //
-// Copyleft (C) 1999  Oliver Delise - delise@rp-plus.de
+// Copyleft (C) 1999  Oliver Delise - delise@mail.isis.de
 //
 // This program is free software; you can redistribute it and/or
 // modify it under the terms of the GNU General Public License as