Changeset 398 in ntrip for trunk/ntripserver/NtripLinuxServer.c


Ignore:
Timestamp:
Feb 13, 2007, 4:37:58 PM (17 years ago)
Author:
stoecker
Message:

updated version of BKG

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ntripserver/NtripLinuxServer.c

    r339 r398  
    22 * NtripServerLinux.c
    33 *
    4  * Copyright (c) 2003...2005
     4 * Copyright (c) 2003...2007
    55 * German Federal Agency for Cartography and Geodesy (BKG)
    66 *
     
    4141 */
    4242
    43 /* $Id: NtripLinuxServer.c,v 1.24 2006/11/23 14:39:50 stoecker Exp $
     43/*
    4444 * Changes - Version 0.7
    4545 * Sep 22 2003  Steffen Tschirpke <St.Tschirpke@actina.de>
     
    7878 * Changes - Version 0.14
    7979 * May 16 2006  Andrea Stuerze <andrea.stuerze@bkg.bund.de>
    80  *           - bug fix in base64_encode-function
     80 *           - bug fixed in base64_encode-function
    8181 *
    8282 * Changes - Version 0.15
     
    9494 *
    9595 * Changes - Version 0.18
    96  * Nov 23 2006  Dirk Stoecker <soft@dstoecker.de>
     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>
    97106 *           - 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
    98110 *
    99111 */
     
    125137CASTER = 6, LAST};
    126138
    127 #define VERSION         "NTRIP NtripServerLinux/0.17"
     139#define VERSION         "NTRIP NtripServerLinux/0.20"
    128140#define BUFSZ           1024
    129141
     
    134146/* default destination */
    135147#define NTRIP_CASTER    "www.euref-ip.net"
    136 #define NTRIP_PORT     2101
     148#define NTRIP_PORT      2101
    137149
    138150/* default sisnet source */
     
    203215 
    204216  const char *initfile = NULL;
     217 
     218  const char *recvrid=0;
     219  const char *recvrpwd=0;
     220 
    205221  int bindmode = 0;
    206222  int sock_id;
     
    218234    exit(1);
    219235  }
    220   while((c = getopt(argc, argv, "M:i:h:b:p:s:a:m:c:H:P:f:l:u:V:D:U:W:B"))
     236  while((c = getopt(argc, argv, "M:i:h:b:p:s:a:m:c:H:P:f:x:y:l:u:V:D:U:W:B"))
    221237  != EOF)
    222238  {
     
    283299      initfile = optarg;
    284300      break;
     301    case 'x':
     302      recvrid = optarg; 
     303      break;     
     304    case 'y':
     305      recvrpwd = optarg; 
     306      break;           
    285307    case 'u':
    286308      sisnetuser = optarg;
     
    289311      sisnetpassword = optarg;
    290312      break;
    291     case 'c':                  /* password */
     313    case 'c':                  /* DestinationCasterPassword */
    292314      password = optarg;
    293315      break;
    294     case 'H':                  /* host */
     316    case 'H':                  /* SourceCasterHost */
    295317      inhost = optarg;
    296318      break;
    297     case 'P':                  /* port */
     319    case 'P':                  /* SourceCasterPort */
    298320      inport = atoi(optarg);
    299321      if(inport <= 1 || inport > 65535)
     
    584606      }
    585607    }
     608
     609    if (recvrid && recvrpwd && ((mode == TCPSOCKET) || (mode == UDPSOCKET)))
     610    {
     611      if (strlen(recvrid) > (BUFSZ-3)){
     612        fprintf(stderr, "Receiver ID too long\n"); exit(0);
     613      }else{
     614        fprintf(stderr, "Sending user ID for receiver...\n");
     615        nBufferBytes = read(gpsfd, szSendBuffer, BUFSZ);     
     616        strcpy(szSendBuffer, recvrid);
     617        strcat(szSendBuffer,"\r\n");
     618        send(gpsfd,szSendBuffer, strlen(szSendBuffer), MSG_DONTWAIT);
     619      }
     620     
     621      if (strlen(recvrpwd) > (BUFSZ-3)){
     622        fprintf(stderr, "Receiver password too long\n"); exit(0);
     623      }else{
     624        fprintf(stderr, "Sending user password for receiver...\n");
     625        nBufferBytes = read(gpsfd, szSendBuffer, BUFSZ);
     626        strcpy(szSendBuffer, recvrpwd);
     627        strcat(szSendBuffer,"\r\n");
     628        send(gpsfd, szSendBuffer, strlen(szSendBuffer), MSG_DONTWAIT);   
     629      }
     630    }     
    586631    break;
    587632  default:
     
    690735      {
    691736        printf("WARNING: no data received from input\n");
    692         sleep(3);
     737        sleep(3);
    693738        nodata = 1;
    694739        continue;
     
    904949    SERV_HOST_ADDR);
    905950  fprintf(stderr, "    -f initfile send to server\n");
     951  fprintf(stderr, "    -x receiver id\n");
     952  fprintf(stderr, "    -y receiver password\n"); 
    906953  fprintf(stderr, "    -B bindmode: bind to incoming UDP stream\n");
    907954  fprintf(stderr, "  Mode = sisnet:\n");
Note: See TracChangeset for help on using the changeset viewer.