Changeset 595 in ntrip for trunk/ntripclient


Ignore:
Timestamp:
Dec 12, 2007, 10:45:23 AM (12 years ago)
Author:
stoecker
Message:

makefile

Location:
trunk/ntripclient
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/ntripclient/makefile

    r499 r595  
    1 # $Id: makefile,v 1.3 2007/08/30 07:38:24 stoecker Exp $
     1# $Id: makefile,v 1.4 2007/10/05 15:32:13 stuerze Exp $
    22# probably works not with all compilers. Thought this should be easy
    33# fixable. There is nothing special at this source.
    44
     5ifdef windir
     6OPTS = -Wall -W -O3 -DWINDOWSVERSION -lwsock32
     7else
     8OPTS = -Wall -W -O3
     9endif
     10
    511ntripclient: ntripclient.c
    6         $(CC) -Wall -W -O3 $? -o $@
    7 
     12        $(CC) $(OPTS) $? -o $@
    813
    914clean:
    10         $(RM) -f ntripclient core*
     15        $(RM) ntripclient core*
    1116
    1217
  • trunk/ntripclient/ntripclient.c

    r579 r595  
    11/*
    22  Easy example NTRIP client for POSIX.
    3   $Id: ntripclient.c,v 1.35 2007/10/26 14:56:47 stuerze Exp $
     3  $Id: ntripclient.c,v 1.36 2007/11/20 12:54:05 stoecker Exp $
    44  Copyright (C) 2003-2005 by Dirk Stoecker <soft@dstoecker.de>
    55   
     
    5757
    5858/* CVS revision and version */
    59 static char revisionstr[] = "$Revision: 1.35 $";
    60 static char datestr[]     = "$Date: 2007/10/26 14:56:47 $";
     59static char revisionstr[] = "$Revision: 1.36 $";
     60static char datestr[]     = "$Date: 2007/11/20 12:54:05 $";
    6161
    6262enum MODE { HTTP = 1, RTSP = 2, NTRIP1 = 3, AUTO = 4, END };
     
    7474  int         bitrate;
    7575  int         mode;
     76
     77  int         udpport;
     78  int         initudp;
    7679};
    7780
     
    8386static struct option opts[] = {
    8487{ "bitrate",    no_argument,       0, 'b'},
    85 { "data",       required_argument, 0, 'd'},
     88{ "data",       required_argument, 0, 'd'}, /* compatibility */
    8689{ "mountpoint", required_argument, 0, 'm'},
     90{ "initudp",    no_argument,       0, 'I'},
     91{ "udpport",    required_argument, 0, 'P'},
    8792{ "server",     required_argument, 0, 's'},
    8893{ "password",   required_argument, 0, 'p'},
     
    96101{0,0,0,0}};
    97102#endif
    98 #define ARGOPT "-d:m:bhp:r:s:u:n:S:R:M:"
     103#define ARGOPT "-d:m:bhp:r:s:u:n:S:R:M:IP:"
    99104
    100105int stop = 0;
     
    293298  args->proxyport = "2101";
    294299  args->mode = AUTO;
     300  args->initudp = 0;
     301  args->udpport = 0;
    295302  help = 0;
    296303
     
    308315    case 'd':
    309316    case 'm':
    310        if(optarg && *optarg == '?')
    311          args->data = encodeurl(optarg);
    312        else
    313          args->data = optarg;
    314      break;
     317      if(optarg && *optarg == '?')
     318        args->data = encodeurl(optarg);
     319      else
     320        args->data = optarg;
     321      break;
     322    case 'I': args->initudp = 1; break;
     323    case 'P': args->udpport = strtol(optarg, 0, 10); break;
    315324    case 'n': args->nmea = optarg; break;
    316325    case 'b': args->bitrate = 1; break;
     
    552561        /* fill structure with local address information for UDP */
    553562        memset(&local, 0, sizeof(local));
    554         local.sin_family = AF_INET;     
    555         local.sin_port = htons(0);
     563        local.sin_family = AF_INET;
     564        local.sin_port = htons(args.udpport);
    556565        local.sin_addr.s_addr = htonl(INADDR_ANY);
    557566        len = sizeof(local);
     
    670679                exit(1);
    671680              }
     681            }
     682            if(args.initudp)
     683            {
     684              printf("Sending initial UDP packet\n");
     685              struct sockaddr_in casterRTP;
     686              char rtpbuffer[12];
     687              int i;
     688              rtpbuffer[0] = (2<<6);
     689              /* padding, extension, csrc are empty */
     690              rtpbuffer[1] = 96;
     691              /* marker is empty */
     692              rtpbuffer[2] = 0;
     693              rtpbuffer[3] = 0;
     694              rtpbuffer[4] = 0;
     695              rtpbuffer[5] = 0;
     696              rtpbuffer[6] = 0;
     697              rtpbuffer[7] = 0;
     698              rtpbuffer[8] = 0;
     699              rtpbuffer[9] = 0;
     700              rtpbuffer[10] = 0;
     701              rtpbuffer[11] = 0;
     702              /* fill structure with caster address information for UDP */
     703              memset(&casterRTP, 0, sizeof(casterRTP));
     704              casterRTP.sin_family = AF_INET;
     705              casterRTP.sin_port   = htons(((uint16_t)serverport));
     706              casterRTP.sin_addr   = *((struct in_addr *)he->h_addr);
     707
     708              if((i = sendto(sockudp, rtpbuffer, 12, 0,
     709              (struct sockaddr *) &casterRTP, sizeof(casterRTP))) != 12)
     710                perror("WARNING: could not send initial UDP packet");
    672711            }
    673712
Note: See TracChangeset for help on using the changeset viewer.