Changeset 466 in ntrip


Ignore:
Timestamp:
Jun 6, 2007, 11:44:27 AM (15 years ago)
Author:
stoecker
Message:

updated release stuff

Location:
trunk
Files:
10 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ntripserver/NtripLinuxServer.c

    r439 r466  
    11/*
    2  * NtripServerLinux.c
     2 * $Id: NtripLinuxClient.c,v 1.27 2007/05/16 14:16:21 stoecker Exp $
    33 *
    44 * Copyright (c) 2003...2007
     
    1010 * Designed by Informatik Centrum Dortmund http://www.icd.de
    1111 *
    12  * NTRIP is currently an experimental technology.
    1312 * The BKG disclaims any liability nor responsibility to any person or
    1413 * entity with respect to any loss or damage caused, or alleged to be
     
    4140 */
    4241
    43 /*
    44  * Changes - Version 0.7
    45  * Sep 22 2003  Steffen Tschirpke <St.Tschirpke@actina.de>
    46  *           - socket support
    47  *           - command line option handling
    48  *           - error handling
    49  *           - help screen
    50  *
    51  * Changes - Version 0.9
    52  * Feb 15 2005  Dirk Stoecker <soft@dstoecker.de>
    53  *           - some minor updates, fixed serial baudrate settings
    54  *
    55  * Changes - Version 0.10
    56  * Apr 05 2005  Dirk Stoecker <soft@dstoecker.de>
    57  *           - some cleanup and miscellaneous fixes
    58  *           - replaced non-working simulate with file input (stdin)
    59  *           - TCP sending now somewhat more stable
    60  *           - cleanup of error handling
    61  *           - Modes may be symbolic and not only numeric
    62  *
    63  * Changes - Version 0.11
    64  * Jun 02 2005  Dirk Stoecker <soft@dstoecker.de>
    65  *           - added SISNeT support
    66  *           - added UDP support
    67  *           - cleanup of host and port handling
    68  *           - added inactivity alarm of 60 seconds
    69  *
    70  * Changes - Version 0.12
    71  * Jun 07 2005  Dirk Stoecker <soft@dstoecker.de>
    72  *           - added UDP bindmode
    73  *
    74  * Changes - Version 0.13
    75  * Apr 25 2006  Andrea Stuerze <andrea.stuerze@bkg.bund.de>
    76  *           - added stream retrieval from caster
    77  *
    78  * Changes - Version 0.14
    79  * May 16 2006  Andrea Stuerze <andrea.stuerze@bkg.bund.de>
    80  *           - bug fixed in base64_encode-function
    81  *
    82  * Changes - Version 0.15
    83  * Jun 02 2006  Georg Weber <georg.weber@bkg.bund.de>
    84  *           - modification for SISNeT 3.1 protocol
    85  *
    86  * Changes - Version 0.16
    87  * Jul 06 2006 Andrea Stuerze <andrea.stuerze@bkg.bund.de>
    88  *           - more flexible caster's response
    89  *
    90  * Changes - Version 0.17
    91  * Jul 27 2006  Dirk Stoecker <soft@dstoecker.de>
    92  *           - fixed some problems with caster download
    93  *           - some minor cosmetic changes
    94  *
    95  * Changes - Version 0.18
    96  * Oct 30 2006 Andrea Stuerze <andrea.stuerze@bkg.bund.de>
    97  *           - added possibility to send receiver ID with password
    98  *             restricted to mode UDPSOCKET and TCPSOCKET.
    99  *
    100  * Changes - Version 0.19
    101  * Nov 30 2006 Andrea Stuerze <andrea.stuerze@bkg.bund.de>
    102  *           - bug fixed in Mode 2
    103  *
    104  * Changes - Version 0.20
    105  * Feb 13 2007  Dirk Stoecker <soft@dstoecker.de>
    106  *           - default port changed from 80 to 2101
    107  *           - fixed illegal memory access
    108  *           - cleanup of no data alarm timer
    109  *           - fixed zero byte handling in buffers
    110  *
    111  */
     42/* CVS revision and version */
     43static char revisionstr[] = "$Revision: 1.27 $";
     44static char datestr[]     = "$Date: 2007/05/16 14:16:21 $";
    11245
    11346#include <ctype.h>
     
    14174CASTER = 6, LAST};
    14275
    143 #define VERSION         "NTRIP NtripServerLinux/0.20"
     76#define AGENTSTRING     "NTRIP NtripServerLinux"
    14477#define BUFSZ           1024
    14578
     
    168101static int openserial(const char * tty, int blocksz, int baud);
    169102static void send_receive_loop(int sock, int fd);
    170 static void usage(int);
     103static void usage(int, char*);
    171104static int encode(char *buf, int size, const char *user, const char *pwd);
    172105
     
    230163  struct sockaddr_in addr;
    231164
     165  setbuf(stdout, 0);
     166  setbuf(stdin, 0);
     167  setbuf(stderr, 0);
     168
     169  char *a;
     170  int i = 0;
     171  for(a = revisionstr+11; *a && *a != ' '; ++a)
     172    revisionstr[i++] = *a;
     173  revisionstr[i] = 0;
     174  datestr[0] = datestr[7];
     175  datestr[1] = datestr[8];
     176  datestr[2] = datestr[9];
     177  datestr[3] = datestr[10];
     178  datestr[5] = datestr[12];
     179  datestr[6] = datestr[13];
     180  datestr[8] = datestr[15];
     181  datestr[9] = datestr[16];
     182  datestr[4] = datestr[7] = '-';
     183  datestr[10] = 0;
     184
    232185  signal(SIGALRM,sighandler_alarm);
    233186  alarm(ALARMTIME);
     
    235188  if(argc <= 1)
    236189  {
    237     usage(2);
     190    usage(2, argv[0]);
    238191    exit(1);
    239192  }
     
    254207      {
    255208        fprintf(stderr, "ERROR: can't convert %s to a valid mode\n", optarg);
    256         usage(-1);
     209        usage(-1, argv[0]);
    257210      }
    258211      break;
     
    270223      {
    271224        fprintf(stderr, "ERROR: unknown SISNeT version %s\n", optarg);
    272         usage(-2);
     225        usage(-2, argv[0]);
    273226      }
    274227      break;
     
    279232        fprintf(stderr, "ERROR: can't convert %s to valid serial speed\n",
    280233          optarg);
    281         usage(1);
     234        usage(1, argv[0]);
    282235      }
    283236      break;
     
    291244        fprintf(stderr,
    292245          "ERROR: can't convert %s to a valid HTTP server port\n", optarg);
    293         usage(1);
     246        usage(1, argv[0]);
    294247      }
    295248      break;
     
    327280        fprintf(stderr, "ERROR: can't convert %s to a valid port number\n",
    328281          optarg);
    329         usage(1);
     282        usage(1, argv[0]);
    330283      }
    331284      break;
     
    341294    case 'h':                  /* help */
    342295    case '?':
    343       usage(0);
     296      usage(0, argv[0]);
    344297      break;
    345298    default:
    346       usage(2);
     299      usage(2, argv[0]);
    347300      break;
    348301    }
     
    360313    }
    361314    fprintf(stderr, "\n");
    362     usage(1);                   /* never returns */
     315    usage(1, argv[0]);                   /* never returns */
    363316  }
    364317
     
    429382      {
    430383        fprintf(stderr, "ERROR: host %s unknown\n", inhost);
    431         usage(-2);
     384        usage(-2, argv[0]);
    432385      }
    433386
     
    480433          nBufferBytes=snprintf(szSendBuffer, sizeof(szSendBuffer)-40,
    481434          "GET /%s HTTP/1.0\r\n"
    482           "User-Agent: %s\r\n"
    483           "Authorization: Basic ", stream_name, VERSION);
     435          "User-Agent: %s/%s\r\n"
     436          "Authorization: Basic ", stream_name, AGENTSTRING, revisionstr);
    484437          /* second check for old glibc */
    485438          if(nBufferBytes > (int)sizeof(szSendBuffer)-40 || nBufferBytes < 0)
     
    504457          nBufferBytes = snprintf(szSendBuffer, sizeof(szSendBuffer),
    505458          "GET /%s HTTP/1.0\r\n"
    506           "User-Agent: %s\r\n"
    507           "\r\n", stream_name, VERSION);
     459          "User-Agent: %s/%s\r\n"
     460          "\r\n", stream_name, AGENTSTRING, revisionstr);
    508461        }
    509462        if((send(gpsfd, szSendBuffer, (size_t)nBufferBytes, 0))
     
    635588    break;
    636589  default:
    637     usage(-1);
     590    usage(-1, argv[0]);
    638591    break;
    639592  }
     
    645598    {
    646599      fprintf(stderr, "ERROR: host %s unknown\n", outhost);
    647       usage(-2);
     600      usage(-2, argv[0]);
    648601    }
    649602
     
    676629    /* send message to caster */
    677630    nBufferBytes = sprintf(szSendBuffer, "SOURCE %s /%s\r\nSource-Agent: "
    678     VERSION "\r\n\r\n", password, mountpoint);
     631    "%s/%s\r\n\r\n", password, mountpoint, AGENTSTRING, revisionstr);
    679632    if((send(sock_id, szSendBuffer, (size_t)nBufferBytes, 0)) != nBufferBytes)
    680633    {
     
    926879__attribute__ ((noreturn))
    927880#endif /* __GNUC__ */
    928 void usage(int rc)
     881void usage(int rc, char *name)
    929882{
    930   fprintf(stderr, "Usage: " VERSION " [OPTIONS]" COMPILEDATE "\n");
     883  fprintf(stderr, "Version %s (%s) GPL" COMPILEDATE "\nUsage:\n%s [OPTIONS]",
     884    revisionstr, datestr, name);
    931885  fprintf(stderr, "  Options are: [-]           \n");
    932886  fprintf(stderr, "    -a DestinationCaster name or address (default: %s)\n",
Note: See TracChangeset for help on using the changeset viewer.