- Timestamp:
- Nov 2, 2006, 2:54:43 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/rtcm3torinex/rtcm3torinex.c
r268 r269 1 1 /* 2 2 Converter for RTCM3 data to RINEX. 3 $Id: rtcm3torinex.c,v 1. 5 2006/08/29 15:42:36stoecker Exp $3 $Id: rtcm3torinex.c,v 1.6 2006/11/02 13:34:00 stoecker Exp $ 4 4 Copyright (C) 2005-2006 by Dirk Stoecker <stoecker@euronik.eu> 5 5 … … 43 43 #endif 44 44 45 #ifndef sparc 46 #include <stdint.h> 47 #endif 48 45 49 #include "rtcm3torinex.h" 46 50 47 51 /* CVS revision and version */ 48 static char revisionstr[] = "$Revision: 1.5 $"; 49 static char datestr[] = "$Date: 2006/08/29 15:42:36 $"; 50 51 static const char encodingTable [64] = { 52 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P', 53 'Q','R','S','T','U','V','W','X','Y','Z','a','b','c','d','e','f', 54 'g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v', 55 'w','x','y','z','0','1','2','3','4','5','6','7','8','9','+','/' 56 }; 57 58 /* does not buffer overrun, but breaks directly after an error */ 59 /* returns the number of required bytes */ 60 static int encode(char *buf, int size, const char *user, const char *pwd) 61 { 62 unsigned char inbuf[3]; 63 char *out = buf; 64 int i, sep = 0, fill = 0, bytes = 0; 65 66 while(*user || *pwd) 67 { 68 i = 0; 69 while(i < 3 && *user) inbuf[i++] = *(user++); 70 if(i < 3 && !sep) {inbuf[i++] = ':'; ++sep; } 71 while(i < 3 && *pwd) inbuf[i++] = *(pwd++); 72 while(i < 3) {inbuf[i++] = 0; ++fill; } 73 if(out-buf < size-1) 74 *(out++) = encodingTable[(inbuf [0] & 0xFC) >> 2]; 75 if(out-buf < size-1) 76 *(out++) = encodingTable[((inbuf [0] & 0x03) << 4) 77 | ((inbuf [1] & 0xF0) >> 4)]; 78 if(out-buf < size-1) 79 { 80 if(fill == 2) 81 *(out++) = '='; 82 else 83 *(out++) = encodingTable[((inbuf [1] & 0x0F) << 2) 84 | ((inbuf [2] & 0xC0) >> 6)]; 85 } 86 if(out-buf < size-1) 87 { 88 if(fill >= 1) 89 *(out++) = '='; 90 else 91 *(out++) = encodingTable[inbuf [2] & 0x3F]; 92 } 93 bytes += 4; 94 } 95 if(out-buf < size) 96 *out = 0; 97 return bytes; 98 } 52 static char revisionstr[] = "$Revision: 1.6 $"; 99 53 100 54 static uint32_t CRC24(long size, const unsigned char *buf) … … 433 387 struct tm * t2; 434 388 389 #ifdef NO_RTCM3_MAIN 390 if(revisionstr[0] == '$') 391 { 392 char *a; 393 int i=0; 394 for(a = revisionstr+11; *a && *a != ' '; ++a) 395 revisionstr[i++] = *a; 396 revisionstr[i] = 0; 397 } 398 #endif 399 435 400 str = getenv("USER"); 436 401 if(!str) str = ""; … … 655 620 656 621 converttime(&cti, Parser->Data.week, 657 floor(Parser->Data.timeofweek/1000.0));622 (int)floor(Parser->Data.timeofweek/1000.0)); 658 623 printf(" %02d %2d %2d %2d %2d %10.7f 0%3d", 659 624 cti.year%100, cti.month, cti.day, cti.hour, cti.minute, cti.second … … 727 692 728 693 #ifndef NO_RTCM3_MAIN 694 static char datestr[] = "$Date: 2006/11/02 13:34:00 $"; 695 729 696 /* The string, which is send as agent in HTTP request */ 730 697 #define AGENTSTRING "NTRIP NtripRTCM3ToRINEX" 731 698 732 699 #define MAXDATASIZE 1000 /* max number of bytes we can get at once */ 700 701 static const char encodingTable [64] = { 702 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P', 703 'Q','R','S','T','U','V','W','X','Y','Z','a','b','c','d','e','f', 704 'g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v', 705 'w','x','y','z','0','1','2','3','4','5','6','7','8','9','+','/' 706 }; 707 708 /* does not buffer overrun, but breaks directly after an error */ 709 /* returns the number of required bytes */ 710 static int encode(char *buf, int size, const char *user, const char *pwd) 711 { 712 unsigned char inbuf[3]; 713 char *out = buf; 714 int i, sep = 0, fill = 0, bytes = 0; 715 716 while(*user || *pwd) 717 { 718 i = 0; 719 while(i < 3 && *user) inbuf[i++] = *(user++); 720 if(i < 3 && !sep) {inbuf[i++] = ':'; ++sep; } 721 while(i < 3 && *pwd) inbuf[i++] = *(pwd++); 722 while(i < 3) {inbuf[i++] = 0; ++fill; } 723 if(out-buf < size-1) 724 *(out++) = encodingTable[(inbuf [0] & 0xFC) >> 2]; 725 if(out-buf < size-1) 726 *(out++) = encodingTable[((inbuf [0] & 0x03) << 4) 727 | ((inbuf [1] & 0xF0) >> 4)]; 728 if(out-buf < size-1) 729 { 730 if(fill == 2) 731 *(out++) = '='; 732 else 733 *(out++) = encodingTable[((inbuf [1] & 0x0F) << 2) 734 | ((inbuf [2] & 0xC0) >> 6)]; 735 } 736 if(out-buf < size-1) 737 { 738 if(fill >= 1) 739 *(out++) = '='; 740 else 741 *(out++) = encodingTable[inbuf [2] & 0x3F]; 742 } 743 bytes += 4; 744 } 745 if(out-buf < size) 746 *out = 0; 747 return bytes; 748 } 733 749 734 750 static int stop = 0;
Note:
See TracChangeset
for help on using the changeset viewer.