/* Generated by XDS Modula-2 to ANSI C v4.20 translator */ #define X2C_int32 #define X2C_index32 #ifndef X2C_H_ #include "X2C.h" #endif #define udpgate4_C_ #ifndef udp_H_ #include "udp.h" #endif #ifndef tcp_H_ #include "tcp.h" #endif #ifndef osi_H_ #include "osi.h" #endif #include #ifndef Select_H_ #include "Select.h" #endif #ifndef aprspos_H_ #include "aprspos.h" #endif #ifndef aprsstr_H_ #include "aprsstr.h" #endif #include #ifndef libsrtm_H_ #include "libsrtm.h" #endif /* axudp / tcpip aprs-is gateway and message repeater by OE5DXL */ #define udpgate4_CALLLEN 7 #define udpgate4_HASHSIZE 65536 #define udpgate4_VERS "udpgate 0.79" #define udpgate4_CPUTEMPFN "/sys/class/thermal/thermal_zone0/temp" #define udpgate4_CONNECTS "connects" #define udpgate4_INDEXHTML "index.html" #define udpgate4_INFOHTML "info.html" #define udpgate4_KEEPALIVE_IDLE_USER 300 #define udpgate4_KEEPALIVE_INTERVALL_U 60 #define udpgate4_KEEPALIVE_COUNT_USER 3 #define udpgate4_KEEPALIVE_IDLE_IS 180 #define udpgate4_KEEPALIVE_INTERVALL_I 30 #define udpgate4_KEEPALIVE_COUNT_IS 2 #define udpgate4_TOCALL "APNL51" #define udpgate4_HTTPTIMEOUT 60 #define udpgate4_APRSLISTENSOCKS 4 /* max same time tcp connects */ #define udpgate4_WWWLISTENSOCKS 16 /* max same time www tcp connects */ #define udpgate4_UDPSHOWTIME 600 /* show udp in html */ #define udpgate4_GATECONNDELAY 30 #define udpgate4_MAXINTERNALDELAY 5 /* max seconds between udp ports read to not discard data */ #define udpgate4_DEFAULTPONGTIME 30 /* s after last #ping stop datatransfer */ #define udpgate4_OLDMSGRETRY 4 #define udpgate4_DAYSEC 86400 #define udpgate4_PI 3.1415926535898 #define udpgate4_DEGSYM "\260" #define udpgate4_MAXAFC 1000000 typedef char MONCALL[10]; typedef char FILENAME[1024]; typedef char FRAMEBUF[512]; typedef char FILTERST[256]; enum RES {udpgate4_resOK, udpgate4_resDUP, udpgate4_resMSG, udpgate4_resQUERY, udpgate4_resUNGATE, udpgate4_resBADPATH, udpgate4_resNOPASS, udpgate4_resLEN, udpgate4_resSRCCAL, udpgate4_resDESTCAL, udpgate4_resVIACAL, udpgate4_resNCAL, udpgate4_resQAZ, udpgate4_resDELAY, udpgate4_resFILT, udpgate4_resLOG}; typedef char SORTBY[4][2]; /* FRAMEBUF=ARRAY[0..256+3+11*10] OF CHAR; */ typedef uint32_t CHSET[4]; struct BEACON { uint32_t bintervall; FILENAME bfile; uint32_t btime; }; struct POSCALL; struct POSCALL { MONCALL call; char typ0; struct aprsstr_POSITION pos; }; typedef MONCALL FILTERCALLS[9]; struct FILTERS; struct FILTERS { char typ0; struct aprsstr_POSITION base; struct aprsstr_POSITION edge; float radius; FILTERCALLS viacalls; char notvia; FILTERCALLS entrycalls; char notentry; FILTERCALLS prefixes; char notprefix; FILTERCALLS bud; char notbud; FILTERCALLS objects; char notobject; FILTERCALLS destcalls; char notdestcall; FILTERCALLS msgs; char notmsgs; FILTERCALLS q; char notq; FILTERCALLS symbols; char notsymbols; char typs[13]; char nottyps; }; typedef char WWWB[1401]; struct WWWBUF; typedef struct WWWBUF * pWWWBUF; struct WWWBUF { WWWB buf; int32_t tlen; char push; pWWWBUF next; }; struct QWatch; struct QWatch { uint32_t lasttb; int32_t qsize; int32_t lastqb; int32_t txbyte[60]; }; struct TCPSOCK; typedef struct TCPSOCK * pTCPSOCK; struct TCPSOCK { pTCPSOCK next; int32_t fd; uint32_t beacont; uint32_t connt; uint32_t pongtime; char slowlink; char passvalid; char pingout; /* ping timeout state */ char service; uint32_t gatepri; char ipnum[64]; char port[6]; struct POSCALL user; char vers[21]; uint32_t wwwst; uint32_t reload; SORTBY sortby; struct QWatch qwatch; uint32_t txframes; uint32_t txbytes; uint32_t txbytesh; uint32_t rxframes; uint32_t rxbytes; uint32_t rxbytesh; uint32_t losttxframes; uint32_t lostrxframes; struct FILTERS filters; FILTERST outfilterst; /* for www show outconn filters */ int32_t rpos; int32_t tlen; FRAMEBUF rbuf; char tbuf[1024]; char get[256]; pWWWBUF txbuf; }; struct UDPSOCK; typedef struct UDPSOCK * pUDPSOCK; struct _0; struct _0 { uint32_t uip; uint32_t uport; uint32_t rxframes; uint32_t rxbytes; uint32_t utime; uint32_t dtime; }; struct UDPSOCK { pUDPSOCK next; int32_t fd; aprsstr_GHOSTSET ghosts; char rawread; char checkip; uint32_t ip; uint32_t bindport; uint32_t dport; uint32_t lasttxtime; /* for net to rf bit/s limit */ uint32_t laststat; float torfradius; /* radius 0 no gateing */ uint32_t maxbytes; /* byte/s tx */ uint32_t lasttxbytes; /* for tx byte/s limit */ uint32_t txframes; uint32_t txbytes; char allpathkey[10]; /* keyword on comment for allpath */ char portname[10]; struct _0 stat[16]; }; enum GATEFILT {udpgate4_gUNGATE, udpgate4_gRFONLY, udpgate4_gNOGATE, udpgate4_gTCPIP, udpgate4_gTCPXX, udpgate4_gQ}; struct UDPSET; struct UDPSET { int32_t txd; int32_t level; int32_t quali; int32_t afc; int32_t snr; char longcalls; }; #define udpgate4_MAXHEARD 500 #define udpgate4_cUSERMSG ":" #define udpgate4_USERACK "{" #define udpgate4_cTHIRDPARTY "}" #define udpgate4_ICONDIR "icon" #define udpgate4_CALLINKFN "calllink.txt" /* build an URL for a klicked mh call */ #define udpgate4_SERVERLINKFN "serverlink.txt" /* build an URL for a klicked server ip */ #define udpgate4_OBJECTLINKFN "objectlink.txt" /* build an URL for a klicked mh object */ #define udpgate4_MAPLINKFN "maplink.txt" /* build an URL for map on klicked raw object */ #define udpgate4_MHSTEPS 48 #define udpgate4_tCELSIUS "C" #define udpgate4_tSPEED "S" #define udpgate4_tJUNK "J" #define udpgate4_tUNK "U" #define udpgate4_tPOS "" #define udpgate4_UNACKRET 1 #define udpgate4_MSGLEN 67 typedef char MSGTEXT[68]; typedef char ACKTEXT[5]; typedef char REPLYACK[2]; enum SOURCE {udpgate4_OBSOLET, udpgate4_NET, udpgate4_INDIR, udpgate4_DIR}; struct MESSAGE; typedef struct MESSAGE * pMESSAGE; struct MESSAGE { pMESSAGE next; uint32_t chkt; uint32_t txtime; uint32_t gentime; uint32_t txport; uint32_t msg2rf; uint32_t msg2net; uint32_t ack2rf; uint32_t ack2net; uint32_t retryc; uint32_t spamcnt; uint8_t acksrc; uint8_t src; char reject; char acked; char ackackt; char queryrep; MONCALL from; MONCALL to; ACKTEXT ack; REPLYACK replyack; MSGTEXT text; /* no text is ack */ }; struct RAWTEXT; typedef struct RAWTEXT * pRAWTEXT; struct RAWTEXT { pRAWTEXT next; uint32_t htime; uint32_t txd; uint32_t quali; uint32_t len; int32_t afc; int32_t snr; struct aprsstr_POSITION position; char text[1024]; }; struct HEARD; typedef struct HEARD * pHEARD; struct _1; struct _1 { uint16_t pack; uint16_t junk; }; struct HEARD { pHEARD next; uint32_t fromrx; uint32_t mhtime; MONCALL call; uint32_t cntt; struct aprsstr_POSITION position; uint32_t dir; int32_t objtimediff; int32_t altitude; char sym; char symt; struct _1 cnt[49]; char head[41]; char datatyp; float mhz; float clb; float data; double sortval; /* sort value inserted depending on sort by */ char altfromsrtm; char ungate; /* flag set by user to not igate this direct heard */ uint16_t txd; uint8_t quali; short level; signed char snr; int32_t afc; pRAWTEXT rawtext[2]; /* normal / junk raw frame storage */ }; static uint32_t msgsendtime; static uint32_t udpgate4_POLYNOM = 0x8408UL; static uint32_t udpgate4_CRCINIT = 0xFFFFUL; static uint32_t udpgate4_CRCRESULT = 0x9F0BUL; #define udpgate4_CR "\015" #define udpgate4_LF "\012" #define udpgate4_cUSERMESSAGE ":" #define udpgate4_cISGATEWAY "G" #define udpgate4_cISSERVER "S" #define udpgate4_cISWWW "W" #define udpgate4_cTELEMETRY "T" /* STYLE='>1)^0x8408UL); else crc = crc>>1; } /* end for */ CRCL[c] = (uint8_t)crc; CRCH[c] = (uint8_t)(255UL-(crc>>8)); } /* end for */ } /* end Gencrctab() */ static void elevation(float * el, float * c, struct aprsstr_POSITION home0, float homealt0, struct aprsstr_POSITION dist, float distalt) { float sb; float r; float s; float b; float a; float z1; float y1; float x1; float z0; float y00; float x0; *el = (-1000.0f); aprspos_wgs84s(home0.lat, home0.long0, homealt0*0.001f, &x0, &y00, &z0); aprspos_wgs84s(dist.lat, dist.long0, distalt*0.001f, &x1, &y1, &z1); a = osic_sqrt(x0*x0+y00*y00+z0*z0); b = osic_sqrt(x1*x1+y1*y1+z1*z1); x1 = x1-x0; y1 = y1-y00; z1 = z1-z0; *c = osic_sqrt(x1*x1+y1*y1+z1*z1); /* halbwinkelsatz */ s = (a+b+*c)*0.5f; if (s==0.0f) return; r = X2C_DIVR((s-a)*(s-b)*(s-*c),s); if (r<=0.0f) return; r = osic_sqrt(r); sb = s-b; if (sb!=0.0f) *el = 1.1459155902616E+2f*osic_arctan(X2C_DIVR(r,sb))-90.0f; else *el = 90.0f; } /* end elevation() */ static void skipblank(const char s[], uint32_t s_len, uint32_t * p) { while (*p' ') { aprsstr_Append(s, s_len, tab[j], 10ul); } ++j; } } } /* end wrcalls() */ static void FiltToStr(struct FILTERS f, char s[], uint32_t s_len) { struct FILTERS * anonym; s[0UL] = 0; { /* with */ struct FILTERS * anonym = &f; if (anonym->typ0=='a') { aprsstr_Assign(s, s_len, "a", 2ul); app(s, s_len, anonym->base.lat, 1); app(s, s_len, anonym->base.long0, 1); app(s, s_len, anonym->edge.lat, 1); app(s, s_len, anonym->edge.long0, 1); } else if (anonym->typ0=='r') { aprsstr_Assign(s, s_len, "r", 2ul); app(s, s_len, anonym->base.lat, 1); app(s, s_len, anonym->base.long0, 1); app(s, s_len, anonym->radius, 0); } else if (anonym->typ0=='m') { aprsstr_Assign(s, s_len, "m", 2ul); app(s, s_len, anonym->radius, 0); } wrcalls(s, s_len, anonym->viacalls, 9ul, anonym->notvia, 'd'); wrcalls(s, s_len, anonym->entrycalls, 9ul, anonym->notentry, 'e'); wrcalls(s, s_len, anonym->prefixes, 9ul, anonym->notprefix, 'p'); wrcalls(s, s_len, anonym->bud, 9ul, anonym->notbud, 'b'); wrcalls(s, s_len, anonym->objects, 9ul, anonym->notobject, 'o'); wrcalls(s, s_len, anonym->destcalls, 9ul, anonym->notdestcall, 'u'); wrcalls(s, s_len, anonym->msgs, 9ul, anonym->notmsgs, 'g'); wrcalls(s, s_len, anonym->q, 9ul, anonym->notq, 'q'); wrcalls(s, s_len, anonym->symbols, 9ul, anonym->notsymbols, 's'); if (anonym->typs[0U]) { aprsstr_Append(s, s_len, " ", 2ul); if (anonym->nottyps) aprsstr_Append(s, s_len, "-", 2ul); aprsstr_Append(s, s_len, "t/", 3ul); aprsstr_Append(s, s_len, anonym->typs, 13ul); } } } /* end FiltToStr() */ static char Watchclock(uint32_t * t, uint32_t intervall) { uint32_t tn; if (intervall>0UL || *t==0UL) { /* send once */ tn = systime; if (*t<=tn) { *t += intervall; if (*t<=tn) *t = tn+intervall; return 1; } } return 0; } /* end Watchclock() */ static uint32_t udpgate4_ROOT = 0x73E2UL; static uint32_t call2pass(const char c[], uint32_t c_len) { uint32_t i0; uint32_t s; s = 0x73E2UL; i0 = 0UL; while ((i0<=c_len-1 && c[i0]) && c[i0]!='-') { s = s^X2C_LSH((uint32_t)(uint32_t)(uint8_t)X2C_CAP(c[i0]),32, (int32_t)!(i0&1)*8L); ++i0; } return (uint32_t)(s&0x7FFFUL); } /* end call2pass() */ static int32_t GetSec(char h[], uint32_t h_len, uint32_t * p, uint32_t * n) { char ok0; int32_t GetSec_ret; X2C_PCOPY((void **)&h,h_len); h[h_len-1] = 0; *n = 0UL; ok0 = 0; while ((uint8_t)h[*p]>='0' && (uint8_t)h[*p]<='9') { ok0 = 1; *n = ( *n*10UL+(uint32_t)(uint8_t)h[*p])-48UL; ++*p; } if (!ok0) { GetSec_ret = -1L; goto label; } GetSec_ret = 0L; label:; X2C_PFREE(h); return GetSec_ret; } /* end GetSec() */ static char callok(const char h[], uint32_t h_len) { uint32_t lit; uint32_t num; uint32_t i0; char c; num = 0UL; lit = 0UL; i0 = 0UL; for (;;) { c = h[i0]; if ((uint8_t)c>='0' && (uint8_t)c<='9') ++num; else if ((uint8_t)c>='A' && (uint8_t)c<='Z') ++lit; else break; ++i0; } if ((lit<2UL || num==0UL) || num>2UL) return 0; if (h[i0]=='-') { ++i0; if (h[i0]=='1') { ++i0; if ((uint8_t)h[i0]>='0' && (uint8_t)h[i0]<='5') ++i0; } else { if ((uint8_t)h[i0]<'1' || (uint8_t)h[i0]>'9') return 0; ++i0; } } return h[i0]==0; } /* end callok() */ static void readurlsfile(const char gatesfn0[], uint32_t gatesfn_len) { uint32_t i0; uint32_t n; int32_t ii; int32_t len; int32_t fd; FILENAME h; if (verb) osi_WrStrLn("read url-file", 14ul); memset((char *)gateways,(char)0,sizeof(struct _3 [21])); fd = osi_OpenRead(gatesfn0, gatesfn_len); if (fd<0L) { strncpy(h,"-g :file <",1024u); aprsstr_Append(h, 1024ul, gatesfn0, gatesfn_len); aprsstr_Append(h, 1024ul, "> not readable", 15ul); osi_WrStrLn(h, 1024ul); return; } n = 0UL; do { i0 = 0UL; for (;;) { len = osi_RdBin(fd, (char *) &h[i0], 1u/1u, 1UL); if (((len<=0L || i0>=1023UL) || h[i0]=='\015') || h[i0]=='\012') { h[i0] = 0; break; } ++i0; } if (h[0U] && h[0U]!='#') { if (h[0U]=='[') { ii = 1L; while (h[ii] && h[ii]!=']') ++ii; if (h[ii]!=']' || h[ii+1L]!=':') { osi_WrStrLn("urlfile: [url]:port", 20ul); } h[ii] = 0; i0 = 1UL; while (i0<=1023UL) { h[i0-1UL] = h[i0]; ++i0; } } else ii = aprsstr_InStr(h, 1024ul, ":", 2ul); if (ii>=0L) h[ii] = 0; aprsstr_Assign(gateways[n].url, 256ul, h, 1024ul); if (ii>0L) { /* port number */ ++ii; i0 = 0UL; while (ii<=1023L) { h[i0] = h[ii]; ++i0; ++ii; } } else osi_WrStrLn("urlfile: [url]:port", 20ul); ii = aprsstr_InStr(h, 1024ul, "#", 2ul); if (ii>=0L) h[ii] = 0; if (h[0U]==0) { osi_WrStrLn("urlfile: [url]:port#filters", 28ul); } aprsstr_Assign(gateways[n].port, 6ul, h, 1024ul); if (ii>0L) { /* we have a filter string */ ++ii; i0 = 0UL; while (ii<=1023L) { if (h[ii]==',') h[ii] = ' '; h[i0] = h[ii]; ++i0; ++ii; } aprsstr_Assign(gateways[n].filterst, 256ul, h, 1024ul); } ++n; } } while (!(len<=0L || n>20UL)); osic_Close(fd); } /* end readurlsfile() */ static void corrpath(char s[], uint32_t s_len) { uint32_t i0; i0 = aprsstr_Length(s, s_len); if (i0>0UL && s[i0-1UL]!='/') aprsstr_Append(s, s_len, "/", 2ul); } /* end corrpath() */ static aprsstr_GHOSTSET _cnst = {0x00000000UL,0x00000000UL,0x00000000UL, 0x00000000UL,0x00000000UL,0x00000000UL,0x00000000UL, 0x00000000UL,0x00000000UL}; static void parms(void) { char h[4096]; aprsstr_GHOSTSET ghost; char err; char lasth; uint32_t n; uint32_t i0; uint32_t gatecnt; int32_t len; int32_t fd; pUDPSOCK ush; pUDPSOCK usock; int32_t ii; char allkey[10]; struct UDPSOCK * anonym; uint32_t tmp; err = 0; verb = 0; datafilter = 0; gatecnt = 0UL; memcpy(ghost,_cnst,36u); keeptime = 0UL; /*600*/ /* default keep connected to gateway time */ allkey[0U] = 0; aprsstr_showctrl = 1; spamminlen = 65UL; /* percent of line same text is message spam */ for (;;) { osi_NextArg(h, 4096ul); if (h[0U]==0) break; if ((h[0U]=='-' && h[1U]) && h[2U]==0) { lasth = h[1U]; if (lasth=='R' || lasth=='M') { osi_NextArg(h, 4096ul); osic_alloc((char * *) &usock, sizeof(struct UDPSOCK)); if (usock==0) Err("out of memory", 14ul); memset((char *)usock,(char)0,sizeof(struct UDPSOCK)); { /* with */ struct UDPSOCK * anonym = usock; if (aprsstr_GetIp2(h, 4096ul, &anonym->ip, &anonym->dport, &anonym->bindport, &anonym->checkip)<0L) { Err("-R or -M need ip:port:port", 27ul); } anonym->fd = openudp(); anonym->rawread = lasth=='R'; if (anonym->fd<0L || bindudp(anonym->fd, anonym->bindport)<0L) { Err("-R or -M cannot bind udpport", 29ul); } len = socknonblock(anonym->fd); ii = aprsstr_InStr(h, 4096ul, "+", 2ul); if (ii>0L) { i0 = (uint32_t)(ii+1L); if (GetSec(h, 4096ul, &i0, &n)>=0L) { anonym->maxbytes = n; ++i0; if (h[i0-1UL]==':' && GetSec(h, 4096ul, &i0, &n)>=0L) { anonym->torfradius = (float)n; } } } ii = aprsstr_InStr(h, 4096ul, "#", 2ul); /* get port name */ if (ii>0L) { ++ii; i0 = 0UL; while ((i0<=9UL && ii<=4095L) && h[ii]) { anonym->portname[i0] = h[ii]; ++i0; ++ii; } } memcpy(anonym->ghosts,ghost,36u); aprsstr_Assign(anonym->allpathkey, 10ul, allkey, 10ul); anonym->next = 0; } if (udpsocks==0) udpsocks = usock; else { ush = udpsocks; while (ush->next) ush = ush->next; ush->next = usock; } memcpy(ghost,_cnst,36u); } else if (lasth=='a') { osi_NextArg(h, 4096ul); if (!aprsstr_StrToFix(&homealt, h, 4096ul)) { Err("-a altitude in m", 17ul); } } else if (lasth=='B') { osi_NextArg(h, 4096ul); if (h[0U]=='+') { aprsstr_Delstr(h, 4096ul, 0UL, 1UL); objmhfromtcp = 1; } i0 = 0UL; if (GetSec(h, 4096ul, &i0, &n)>=0L) heardtimeobj = n*60UL; else Err("-B minutes", 11ul); } else if (lasth=='c') { callsrc = 1; } else if (X2C_CAP(lasth)=='S') { rfcallchk = lasth=='s'; osi_NextArg(h, 4096ul); aprsstr_Assign(servercall, 10ul, h, 4096ul); if ((servercall[0U]==0 || servercall[0U]=='-') || rfcallchk && !callok(h, 4096ul)) { Err("-s call-ssid", 13ul); } } else if (lasth=='p') { osi_NextArg(h, 4096ul); if ((uint8_t)h[0U]>='0' && (uint8_t)h[0U]<='9') { i0 = 0UL; while (i0<=5UL && (uint8_t)h[i0]>=' ') { passwd[i0] = h[i0]; ++i0; } } else { fd = osi_OpenRead(h, 4096ul); if (fd<0L) Err("-p passcode or passwordfile", 28ul); len = osi_RdBin(fd, (char *)passwd, 6u/1u, 5UL); if (len>=0L) passwd[len] = 0; else Err("-p error with password file", 28ul); osic_Close(fd); } passwd[5U] = 0; i0 = 0UL; while ((uint8_t)passwd[i0]>='0' && (uint8_t)passwd[i0]<='9') { ++i0; } if (i0==0UL || passwd[i0]) Err("-p invalid passcode", 20ul); } else if (lasth=='m') { osi_NextArg(h, 4096ul); i0 = 0UL; if (GetSec(h, 4096ul, &i0, &n)>=0L) maxusers = n; else Err("-m number", 10ul); } else if (lasth=='A') { osi_NextArg(h, 4096ul); if (h[0U]==0 || h[0U]=='-') Err("-A directory", 13ul); aprsstr_Assign(libsrtm_srtmdir, 1024ul, h, 4096ul); corrpath(libsrtm_srtmdir, 1024ul); } else if (lasth=='D') { osi_NextArg(h, 4096ul); if (h[0U]==0 || h[0U]=='-') Err("-D directory", 13ul); aprsstr_Assign(wwwdir, 1024ul, h, 4096ul); corrpath(wwwdir, 1024ul); } else if (lasth=='d') { osi_NextArg(h, 4096ul); i0 = 0UL; if (GetSec(h, 4096ul, &i0, &n)>=0L) dupetime = n; else Err("-d number", 10ul); if (dupetime<27UL) { osi_WrStrLn("-d do not set dupefilter less 27s!", 35ul); } } else if (lasth=='e') { osi_NextArg(h, 4096ul); i0 = 0UL; if (GetSec(h, 4096ul, &i0, &n)>=0L) { if (n==0UL) n = 1UL; gateconndelay = n; } else Err("-e seconds", 11ul); } else if (lasth=='C') { osi_NextArg(h, 4096ul); i0 = 0UL; if (GetSec(h, 4096ul, &i0, &n)>=0L) heardtimetcp = n*60UL; else Err("-C minutes", 11ul); } else if (lasth=='H') { osi_NextArg(h, 4096ul); i0 = 0UL; if (GetSec(h, 4096ul, &i0, &n)>=0L) heardtimew = n*60UL; else Err("-H minutes", 11ul); } else if (lasth=='I') { osi_NextArg(h, 4096ul); i0 = 0UL; if (GetSec(h, 4096ul, &i0, &n)>=0L) heardtimevia = n*60UL; else Err("-I minutes", 11ul); } else if (lasth=='L') { /* ELSIF lasth="i" THEN NextArg(h); IF h[0]="-" THEN h[0]:=0C END; Assign(allkey, h); */ osi_NextArg(h, 4096ul); i0 = 0UL; if (GetSec(h, 4096ul, &i0, &n)>=0L) maxmsg = n; else Err("-L number", 10ul); } else if (lasth=='l') { osi_NextArg(h, 4096ul); i0 = 0UL; if (GetSec(h, 4096ul, &i0, &n)>=0L && h[i0]==':') { logframes = (int32_t)n; ++i0; for (n = 0UL; n<=1023UL; n++) { if (i0<=4095UL) { logframename[n] = h[i0]; ++i0; } } /* end for */ if ((uint8_t)logframename[0U]<=' ') { Err("-l loglevel:filename", 21ul); } } else Err("log format is level:file", 25ul); } else if (lasth=='r') { osi_NextArg(rawlogname, 1024ul); if ((uint8_t)rawlogname[0U]<=' ') { Err("-r rawlogfilename", 18ul); } } else if (lasth=='F') { osi_NextArg(h, 4096ul); i0 = 0UL; if (GetSec(h, 4096ul, &i0, &n)>=0L && h[i0]==':') { mhfilelines = n; ++i0; for (n = 0UL; n<=1023UL; n++) { if (i0<=4095UL) { mhfilename[n] = h[i0]; ++i0; } } /* end for */ if ((uint8_t)mhfilename[0U]<=' ') { Err("-F MHfilename", 14ul); } } else Err("MH File lines:file", 19ul); } else if (lasth=='n') { osi_NextArg(h, 4096ul); i0 = 0UL; if (GetSec(h, 4096ul, &i0, &n)>=0L && h[i0]==':') { netbeaconintervall = n*60UL; ++i0; for (n = 0UL; n<=1023UL; n++) { if (i0<=4095UL) { netbeaconfn[n] = h[i0]; ++i0; } } /* end for */ if ((uint8_t)netbeaconfn[0U]<=' ') { Err("-n netbeacon filename", 22ul); } } else Err("-n netbeacon format is minutes:file", 36ul); } else if (lasth=='N') sendnetmsg = 0; else if (lasth=='E') aprsstr_showctrl = 0; else if (lasth=='t') { osi_NextArg(h, 4096ul); aprsstr_Assign(tcpbindport, 6ul, h, 4096ul); if (h[0U]==0 || h[0U]=='-') Err("-t port", 8ul); } else if (lasth=='w') { osi_NextArg(h, 4096ul); aprsstr_Assign(wwwbindport, 6ul, h, 4096ul); if (h[0U]==0 || h[0U]=='-') { Err("-w port", 8ul); } } else if (lasth=='X') { osi_NextArg(h, 4096ul); aprsstr_Assign(qau, 3ul, h, 4096ul); if (h[0U]==0 || h[0U]=='-') Err("-X q-construct", 15ul); if (qau[0U]!='q') { Err("-X q-construct needs \"q\" at begin", 34ul); } } else if (lasth=='f') { osi_NextArg(h, 4096ul); aprsstr_Assign(serverrangefilter, 256ul, h, 4096ul); if (h[0U]==0 || h[0U]=='-') Err("-f rangefilter", 15ul); tmp = aprsstr_Length(serverrangefilter, 256ul); i0 = 0UL; if (i0<=tmp) for (;; i0++) { if (serverrangefilter[i0]==',') serverrangefilter[i0] = ' '; if (i0==tmp) break; } /* end for */ } else if (lasth=='g') { /* "url port" or "url:port" or "url:port#filter" */ osi_NextArg(h, 4096ul); if (h[0U]==0) Err("-g url port", 12ul); if (h[0U]==':') { /* get urls later from file */ for (i0 = 1UL; i0<=4095UL; i0++) { h[i0-1UL] = h[i0]; } /* end for */ h[4095U] = 0; aprsstr_Assign(gatesfn, 1024ul, h, 4096ul); } else { if (gatecnt>20UL) Err("-g gateway table full", 22ul); h[4095U] = 0; if (h[0U]=='[') { ii = 1L; while (h[ii] && h[ii]!=']') ++ii; if (h[ii]!=']' || h[ii+1L]!=':') { Err("-g [url]:port", 14ul); } h[ii] = 0; i0 = 1UL; while (i0<=4095UL) { h[i0-1UL] = h[i0]; ++i0; } } else ii = aprsstr_InStr(h, 4096ul, ":", 2ul); if (ii>=0L) h[ii] = 0; aprsstr_Assign(gateways[gatecnt].url, 256ul, h, 4096ul); if (ii>0L) { /* port number */ ++ii; i0 = 0UL; while (ii<=4095L) { h[i0] = h[ii]; ++i0; ++ii; } } else osi_NextArg(h, 4096ul); h[4095U] = 0; ii = aprsstr_InStr(h, 4096ul, "#", 2ul); if (ii>=0L) h[ii] = 0; if (h[0U]==0) Err("-g url:port", 12ul); aprsstr_Assign(gateways[gatecnt].port, 6ul, h, 4096ul); if (ii>0L) { /* we have a filter string */ ++ii; i0 = 0UL; while (ii<=4095L) { if (h[ii]==',') h[ii] = ' '; h[i0] = h[ii]; ++i0; ++ii; } aprsstr_Assign(gateways[gatecnt].filterst, 256ul, h, 4096ul); } ++gatecnt; } } else { if (lasth=='h') { osi_WrStrLn(" udpgate 0.79", 29ul); osi_WrStrLn(" -0 send no Data (only Messages and a\ ck) to User with no Filter", 76ul); osi_WrStrLn(" -A srtm directory path to enable ove\ rground calculation (-A /usr/srtm/)", 85ul); osi_WrStrLn(" for objects with \"Clb=\" file WW\ 15MGH.DAC will be needed on this path", 85ul); osi_WrStrLn(" -a Altitude of Igate for elevation c\ alulation (overrides value from srtm)", 87ul); osi_WrStrLn(" -B [+]