New upstream version 6.0.24.15
This commit is contained in:
parent
084ecb74f6
commit
7b2a99c53b
Binary file not shown.
Binary file not shown.
19
APRSCode.c
19
APRSCode.c
|
@ -103,6 +103,7 @@ void SaveAPRSMessage(struct APRSMESSAGE * ptr);
|
|||
void ClearSavedMessages();
|
||||
void GetSavedAPRSMessages();
|
||||
static VOID GPSDConnect(void * unused);
|
||||
int CanPortDigi(int Port);
|
||||
|
||||
extern int SemHeldByAPI;
|
||||
extern int APRSMONDECODE();
|
||||
|
@ -664,8 +665,9 @@ Dll BOOL APIENTRY Init_APRS()
|
|||
memset(&CrossPortMap[0][0], 0, sizeof(CrossPortMap));
|
||||
memset(&APRSBridgeMap[0][0], 0, sizeof(APRSBridgeMap));
|
||||
|
||||
for (i = 1; i <= 32; i++)
|
||||
for (i = 1; i <= MaxBPQPortNo; i++)
|
||||
{
|
||||
if (CanPortDigi(i))
|
||||
CrossPortMap[i][i] = TRUE; // Set Defaults - Same Port
|
||||
CrossPortMap[i][0] = TRUE; // and APRS-IS
|
||||
}
|
||||
|
@ -1945,7 +1947,7 @@ static int APRSProcessLine(char * buf)
|
|||
{
|
||||
SendTo = atoi(ptr); // this gives zero for IS
|
||||
|
||||
if (SendTo > 32)
|
||||
if (SendTo > MaxBPQPortNo)
|
||||
return FALSE;
|
||||
|
||||
Object->PortMap[SendTo] = TRUE;
|
||||
|
@ -2175,6 +2177,12 @@ static int APRSProcessLine(char * buf)
|
|||
if (GetPortTableEntryFromPortNum(Port) == NULL)
|
||||
return FALSE;
|
||||
|
||||
// Check that port can digi (SCS Pactor can't set digi'd bit in calls)
|
||||
|
||||
if (CanPortDigi(Port) == 0)
|
||||
return FALSE;
|
||||
|
||||
|
||||
CrossPortMap[Port][Port] = FALSE; // Cancel Default mapping
|
||||
CrossPortMap[Port][0] = FALSE; // Cancel Default APRSIS
|
||||
|
||||
|
@ -2218,7 +2226,7 @@ static int APRSProcessLine(char * buf)
|
|||
{
|
||||
DigiTo = atoi(ptr); // this gives zero for IS
|
||||
|
||||
if (DigiTo > 32)
|
||||
if (DigiTo > MaxBPQPortNo)
|
||||
return FALSE;
|
||||
|
||||
APRSBridgeMap[Port][DigiTo] = TRUE;
|
||||
|
@ -5238,6 +5246,7 @@ int DecodeAPRSPayload(char * Payload, struct STATIONRECORD * Station)
|
|||
DecodeLocationString(Payload + 18, Object);
|
||||
|
||||
Object->TimeLastUpdated = time(NULL);
|
||||
Object->LastPort = Station->LastPort;
|
||||
Station->Object = Object;
|
||||
return 0;
|
||||
|
||||
|
@ -8168,6 +8177,8 @@ VOID APRSCMD(TRANSPORTENTRY * Session, char * Bufferptr, char * CmdTail, CMDX *
|
|||
else
|
||||
Bufferptr = Cmdprintf(Session, Bufferptr, "but not connected\r");
|
||||
}
|
||||
|
||||
SendCommandReply(Session, REPLYBUFFER, (int)(Bufferptr - (char *)REPLYBUFFER));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -8844,7 +8855,7 @@ int GetAPRSPageInfo(char * Buffer, double N, double S, double W, double E, int a
|
|||
if (lastLat != ptr->Lat)
|
||||
Len += sprintf(&Buffer[Len],"%.4f,%.4f,\r\n|", ptr->Lat, ptr->Lon); //Add current position to end of track
|
||||
else
|
||||
Len += sprintf(&Buffer[Len],"\r\n|", ptr->Lat, ptr->Lon);
|
||||
Len += sprintf(&Buffer[Len],"\r\n|");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
149
BBSHTMLConfig.c
149
BBSHTMLConfig.c
|
@ -398,7 +398,7 @@ int SendHeader(char * Reply, char * Key)
|
|||
}
|
||||
|
||||
|
||||
void ConvertTitletoUTF8(char * Title, char * UTF8Title)
|
||||
void ConvertTitletoUTF8(WebMailInfo * WebMail, char * Title, char * UTF8Title, int Len)
|
||||
{
|
||||
if (WebIsUTF8(Title, (int)strlen(Title)) == FALSE)
|
||||
{
|
||||
|
@ -414,15 +414,26 @@ void ConvertTitletoUTF8(char * Title, char * UTF8Title)
|
|||
wlen = MultiByteToWideChar(CP_ACP, 0, Title, len, BufferW, origlen * 2);
|
||||
len = WideCharToMultiByte(CP_UTF8, 0, BufferW, wlen, UTF8Title, origlen * 2, NULL, NULL);
|
||||
#else
|
||||
int left = 2 * strlen(Title);
|
||||
int len = origlen;
|
||||
iconv_t * icu = NULL;
|
||||
size_t left = Len - 1;
|
||||
size_t len = origlen;
|
||||
|
||||
if (icu == NULL)
|
||||
icu = iconv_open("UTF-8", "CP1252");
|
||||
iconv_t * icu = WebMail->iconv_toUTF8;
|
||||
|
||||
if (WebMail->iconv_toUTF8 == NULL)
|
||||
icu = WebMail->iconv_toUTF8 = iconv_open("UTF-8//IGNORE", "CP1252");
|
||||
|
||||
if (icu == (iconv_t)-1)
|
||||
{
|
||||
strcpy(UTF8Title, Title);
|
||||
WebMail->iconv_toUTF8 = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
char * orig = UTF8Title;
|
||||
|
||||
iconv(icu, NULL, NULL, NULL, NULL); // Reset State Machine
|
||||
iconv(icu, &Title, &len, (char ** __restrict__)&UTF8Title, &left);
|
||||
|
||||
#endif
|
||||
}
|
||||
else
|
||||
|
@ -1681,6 +1692,85 @@ VOID ProcessConfUpdate(struct HTTPConnectionInfo * Session, char * MsgPtr, char
|
|||
HoldAt = GetMultiStringInput(input, "Hat=");
|
||||
HoldBID = GetMultiStringInput(input, "HBID=");
|
||||
|
||||
// Look for fbb style filters
|
||||
|
||||
input = strstr(input, "&Action=");
|
||||
|
||||
// delete old list
|
||||
|
||||
while(Filters && Filters->Next)
|
||||
{
|
||||
FBBFilter * next = Filters->Next;
|
||||
free(Filters);
|
||||
Filters = next;
|
||||
}
|
||||
|
||||
free(Filters);
|
||||
Filters = NULL;
|
||||
|
||||
while (input)
|
||||
{
|
||||
// extract and validate before saving
|
||||
|
||||
FBBFilter Filter;
|
||||
FBBFilter * PFilter;
|
||||
|
||||
memset(&Filter, 0, sizeof(FBBFilter));
|
||||
|
||||
Filter.Action = toupper(input[8]);
|
||||
|
||||
input = strstr(input, "&Type=");
|
||||
|
||||
if (Filter.Action == 'H' || Filter.Action == 'R')
|
||||
{
|
||||
Filter.Type = toupper(input[6]);
|
||||
input = strstr(input, "&From=");
|
||||
memcpy(Filter.From, &input[6], 10);
|
||||
input = strstr(input, "&TO=");
|
||||
strlop(Filter.From, '&');
|
||||
_strupr(Filter.From);
|
||||
memcpy(Filter.TO, &input[4], 10);
|
||||
input = strstr(input, "&AT=");
|
||||
strlop(Filter.TO, '&');
|
||||
_strupr(Filter.TO);
|
||||
memcpy(Filter.AT, &input[4], 10);
|
||||
input = strstr(input, "&BID=");
|
||||
strlop(Filter.AT, '&');
|
||||
_strupr(Filter.AT);
|
||||
memcpy(Filter.BID, &input[5], 10);
|
||||
input = strstr(input, "&MaxLen=");
|
||||
strlop(Filter.BID, '&');
|
||||
_strupr(Filter.BID);
|
||||
Filter.MaxLen = atoi(&input[8]);
|
||||
|
||||
if (Filter.Type == '&') Filter.Type = '*';
|
||||
if (Filter.From[0] == 0) strcpy(Filter.From, "*");
|
||||
if (Filter.TO[0] == 0) strcpy(Filter.TO, "*");
|
||||
if (Filter.AT[0] == 0) strcpy(Filter.AT, "*");
|
||||
if (Filter.BID[0] == 0) strcpy(Filter.BID, "*");
|
||||
|
||||
// add to list
|
||||
|
||||
PFilter = zalloc(sizeof(FBBFilter));
|
||||
|
||||
memcpy(PFilter, &Filter, sizeof(FBBFilter));
|
||||
|
||||
if (Filters == 0)
|
||||
Filters = PFilter;
|
||||
else
|
||||
{
|
||||
FBBFilter * p = Filters;
|
||||
|
||||
while (p->Next)
|
||||
p = p->Next;
|
||||
|
||||
p->Next = PFilter;
|
||||
}
|
||||
}
|
||||
|
||||
input = strstr(input, "&Action=");
|
||||
}
|
||||
|
||||
SaveConfig(ConfigName);
|
||||
GetConfig(ConfigName);
|
||||
}
|
||||
|
@ -2437,7 +2527,7 @@ VOID SendFwdDetails(struct UserInfo * User, char * Reply, int * ReplyLen, char *
|
|||
|
||||
VOID SendConfigPage(char * Reply, int * ReplyLen, char * Key)
|
||||
{
|
||||
int Len;
|
||||
int Len, i;
|
||||
|
||||
char HF[2048] = "";
|
||||
char HT[2048] = "";
|
||||
|
@ -2449,6 +2539,12 @@ VOID SendConfigPage(char * Reply, int * ReplyLen, char * Key)
|
|||
char RB[2048] = "";
|
||||
char WPTO[10000] = "";
|
||||
|
||||
char FBBFilters[100000] = "";
|
||||
|
||||
|
||||
char * ptr = FBBFilters;
|
||||
FBBFilter * Filter = Filters;
|
||||
|
||||
SetMultiStringValue(RejFrom, RF);
|
||||
SetMultiStringValue(RejTo, RT);
|
||||
SetMultiStringValue(RejAt, RA);
|
||||
|
@ -2459,6 +2555,43 @@ VOID SendConfigPage(char * Reply, int * ReplyLen, char * Key)
|
|||
SetMultiStringValue(HoldBID, HB);
|
||||
SetMultiStringValue(SendWPAddrs, WPTO);
|
||||
|
||||
// set up FB style fiters
|
||||
|
||||
ptr += sprintf(ptr,
|
||||
"<table><tr><th>Action</th><th>Type</th><th>From</th><th>To</th><th>@BBS</th><th>Bid</th><th>Max Size</th></tr>");
|
||||
|
||||
while(Filter)
|
||||
{
|
||||
ptr += sprintf(ptr, "<tr>"
|
||||
"<td><input type=text name=Action style=\"text-transform: uppercase\"maxlength=2 size=2 value=%c></td>"
|
||||
"<td><input type=text name=Type style=\"text-transform: uppercase\"maxlength=2 size=2 value=%c></td>"
|
||||
"<td><input type=text name=From style=\"text-transform: uppercase\" maxlength=7 size=7 value=%s></td>"
|
||||
"<td><input type=text name=TO style=\"text-transform: uppercase\" maxlength=7 size=7 value=%s></td>"
|
||||
"<td><input type=text name=AT style=\"text-transform: uppercase\" maxlength=7 size=7 value=%s></td>"
|
||||
"<td><input type=text name=BID style=\"text-transform: uppercase\" maxlength=13 size=13 value=%s></td>"
|
||||
"<td><input type=text name=MaxLen maxlength=6 size=6 value=%d></td></tr>",
|
||||
Filter->Action, Filter->Type, Filter->From, Filter->TO, Filter->AT, Filter->BID, Filter->MaxLen);
|
||||
|
||||
Filter = Filter->Next;
|
||||
}
|
||||
|
||||
// Add a few blank entries for input
|
||||
|
||||
for (i = 0; i < 5; i++)
|
||||
{
|
||||
ptr += sprintf(ptr, "<tr>"
|
||||
"<td><input type=text name=Action style=\"text-transform: uppercase\"maxlength=2 size=2 value=%c></td>"
|
||||
"<td><input type=text name=Type style=\"text-transform: uppercase\"maxlength=2 size=2 value=%c></td>"
|
||||
"<td><input type=text name=From style=\"text-transform: uppercase\" maxlength=7 size=7 value=%s></td>"
|
||||
"<td><input type=text name=TO style=\"text-transform: uppercase\" maxlength=7 size=7 value=%s></td>"
|
||||
"<td><input type=text name=AT style=\"text-transform: uppercase\" maxlength=7 size=7 value=%s></td>"
|
||||
"<td><input type=text name=BID style=\"text-transform: uppercase\" maxlength=13 size=13 value=%s></td>"
|
||||
"<td><input type=text name=MaxLen maxlength=6 size=6 value=%d></td></tr>", ' ', ' ', "", "", "", "", 0);
|
||||
}
|
||||
|
||||
ptr += sprintf(ptr, "</table>");
|
||||
|
||||
Debugprintf("%d", strlen(FBBFilters));
|
||||
|
||||
Len = sprintf(Reply, ConfigTemplate,
|
||||
BBSName, Key, Key, Key, Key, Key, Key, Key, Key, Key,
|
||||
|
@ -2490,7 +2623,7 @@ VOID SendConfigPage(char * Reply, int * ReplyLen, char * Key)
|
|||
(SendWPType == 0) ? CHKD : UNC,
|
||||
(SendWPType == 1) ? CHKD : UNC,
|
||||
WPTO,
|
||||
RF, RT, RA, RB, HF, HT, HA, HB);
|
||||
RF, RT, RA, RB, HF, HT, HA, HB, FBBFilters);
|
||||
|
||||
*ReplyLen = Len;
|
||||
}
|
||||
|
|
209
BBSUtilities.c
209
BBSUtilities.c
|
@ -45,6 +45,7 @@ BOOL OpenMon;
|
|||
|
||||
int reportNewMesageEvents = 0;
|
||||
|
||||
FBBFilter * Filters = NULL;
|
||||
|
||||
extern struct ConsoleInfo BBSConsole;
|
||||
|
||||
|
@ -2078,10 +2079,37 @@ int CountConnectionsOnPort(int CheckPort)
|
|||
return Count;
|
||||
}
|
||||
|
||||
/*
|
||||
REJECT.SYS (\FBB\SYSTEM).
|
||||
|
||||
BOOL CheckRejFilters(char * From, char * To, char * ATBBS, char * BID, char Type)
|
||||
This file is in SYSTEM-directory. With this file it is possible to reject or
|
||||
hold certain types or sizes of messages.
|
||||
|
||||
The first letter of each valid line specifies the action :
|
||||
|
||||
R = Reject : The message will not be received.
|
||||
H = Hold : The message will be received but held until the sysop reviews.
|
||||
L = Local Hold : Only messages created on this BBS will be held.
|
||||
|
||||
# File for rejecting messages. They are rejected with N-BID:
|
||||
#
|
||||
# Type, from, @BBS, to, BID, maximum size:
|
||||
#
|
||||
# * and ? can be used as wildcards (as in MS-DOS)
|
||||
#
|
||||
R B TOTO ALL TATA * 0
|
||||
R B * * VENTE * 0
|
||||
R B * VENTE * * 0
|
||||
H * P1RAT * * * 0
|
||||
L B * * * * 0
|
||||
*/
|
||||
|
||||
|
||||
BOOL CheckRejFilters(char * From, char * To, char * ATBBS, char * BID, char Type, int Len)
|
||||
{
|
||||
char ** Calls;
|
||||
FBBFilter * p = Filters;
|
||||
char ToCopy[256];
|
||||
|
||||
if (Type == 'B' && FilterWPBulls && _stricmp(To, "WP") == 0)
|
||||
return TRUE;
|
||||
|
@ -2145,6 +2173,43 @@ BOOL CheckRejFilters(char * From, char * To, char * ATBBS, char * BID, char Type
|
|||
Calls++;
|
||||
}
|
||||
}
|
||||
|
||||
// check fbb reject.sys type filters
|
||||
|
||||
strcpy(ToCopy, To);
|
||||
_strupr(ToCopy);
|
||||
|
||||
while (p)
|
||||
{
|
||||
if (p->Action != 'R')
|
||||
goto Continue;
|
||||
|
||||
if (p->Type != Type && p->Type != '*')
|
||||
goto Continue;
|
||||
|
||||
if (wildcardcompare(From, p->From) == 0)
|
||||
goto Continue;
|
||||
|
||||
if (wildcardcompare(ToCopy, p->TO) == 0)
|
||||
goto Continue;
|
||||
|
||||
if (ATBBS)
|
||||
if (wildcardcompare(ATBBS, p->AT) == 0)
|
||||
goto Continue;
|
||||
|
||||
if (BID)
|
||||
if (wildcardcompare(BID, p->BID) == 0)
|
||||
goto Continue;
|
||||
|
||||
if (p->MaxLen && Len < p->MaxLen)
|
||||
goto Continue;
|
||||
|
||||
return TRUE; // Hold
|
||||
|
||||
Continue:
|
||||
p = p->Next;
|
||||
}
|
||||
|
||||
return FALSE; // Ok to accept
|
||||
}
|
||||
|
||||
|
@ -2175,9 +2240,12 @@ BOOL CheckValidCall(char * From)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL CheckHoldFilters(char * From, char * To, char * ATBBS, char * BID)
|
||||
BOOL wildcardcompare(char * Target, char * Match);
|
||||
|
||||
BOOL CheckHoldFilters(struct MsgInfo * Msg, char * From, char * To, char * ATBBS, char * BID)
|
||||
{
|
||||
char ** Calls;
|
||||
FBBFilter * p = Filters;
|
||||
|
||||
if (HoldFrom && From)
|
||||
{
|
||||
|
@ -2238,6 +2306,38 @@ BOOL CheckHoldFilters(char * From, char * To, char * ATBBS, char * BID)
|
|||
Calls++;
|
||||
}
|
||||
}
|
||||
|
||||
// check fbb reject.sys type filters
|
||||
|
||||
while (p)
|
||||
{
|
||||
if (p->Action != 'H')
|
||||
goto Continue;
|
||||
|
||||
if (p->Type != Msg->type && p->Type != '*')
|
||||
goto Continue;
|
||||
|
||||
if (wildcardcompare(Msg->from, p->From) == 0)
|
||||
goto Continue;
|
||||
|
||||
if (wildcardcompare(Msg->to, p->TO) == 0)
|
||||
goto Continue;
|
||||
|
||||
if (wildcardcompare(Msg->via, p->AT) == 0)
|
||||
goto Continue;
|
||||
|
||||
if (wildcardcompare(Msg->bid, p->BID) == 0)
|
||||
goto Continue;
|
||||
|
||||
if (p->MaxLen && Msg->length < p->MaxLen)
|
||||
goto Continue;
|
||||
|
||||
return TRUE; // Hold
|
||||
|
||||
Continue:
|
||||
p = p->Next;
|
||||
}
|
||||
|
||||
return FALSE; // Ok to accept
|
||||
}
|
||||
|
||||
|
@ -5361,7 +5461,7 @@ BOOL CreateMessage(CIRCUIT * conn, char * From, char * ToCall, char * ATBBS, cha
|
|||
}
|
||||
else
|
||||
{
|
||||
if (CheckRejFilters(From, ToCall, ATBBS, BID, MsgType))
|
||||
if (CheckRejFilters(From, ToCall, ATBBS, BID, MsgType, 0))
|
||||
{
|
||||
if ((conn->BBSFlags & BBS))
|
||||
{
|
||||
|
@ -6169,7 +6269,7 @@ nextline:
|
|||
HoldReason = "Bad word in title or body";
|
||||
}
|
||||
|
||||
if (CheckHoldFilters(Msg->from, Msg->to, Msg->via, Msg->bid))
|
||||
if (CheckHoldFilters(Msg, Msg->from, Msg->to, Msg->via, Msg->bid))
|
||||
{
|
||||
Msg->status = 'H';
|
||||
HoldReason = "Matched Hold Filters";
|
||||
|
@ -9441,6 +9541,9 @@ VOID SaveConfig(char * ConfigName)
|
|||
char Size[80];
|
||||
struct BBSForwardingInfo DummyForwardingInfo;
|
||||
char Line[1024];
|
||||
char FBBString[8192]= "";
|
||||
FBBFilter * p = Filters;
|
||||
char * ptr = FBBString;
|
||||
|
||||
if (configSaved == 0)
|
||||
{
|
||||
|
@ -9566,6 +9669,18 @@ VOID SaveConfig(char * ConfigName)
|
|||
SaveMultiStringValue(group, "HoldAt", HoldAt);
|
||||
SaveMultiStringValue(group, "HoldBID", HoldBID);
|
||||
|
||||
// Save FBB Filters
|
||||
|
||||
while (p)
|
||||
{
|
||||
ptr += sprintf(ptr, "%c|%c|%s|%s|%s|%s|%d|",
|
||||
p->Action, p->Type, p->From, p->TO, p->AT, p->BID, p->MaxLen);
|
||||
|
||||
p = p->Next;
|
||||
}
|
||||
|
||||
SaveStringValue(group, "FBBFilters", FBBString);
|
||||
|
||||
SaveIntValue(group, "SendWP", SendWP);
|
||||
SaveIntValue(group, "SendWPType", SendWPType);
|
||||
SaveIntValue(group, "FilterWPBulls", FilterWPBulls);
|
||||
|
@ -9964,7 +10079,8 @@ BOOL GetConfig(char * ConfigName)
|
|||
char Size[80];
|
||||
config_setting_t *setting;
|
||||
const char * ptr;
|
||||
|
||||
char FBBString[8192]= "";
|
||||
FBBFilter f;
|
||||
config_init(&cfg);
|
||||
|
||||
/* Read the file. If there is an error, report it and exit. */
|
||||
|
@ -10161,6 +10277,89 @@ BOOL GetConfig(char * ConfigName)
|
|||
HoldAt = GetMultiStringValue(group, "HoldAt");
|
||||
HoldBID = GetMultiStringValue(group, "HoldBID");
|
||||
|
||||
// Get FBB Filters
|
||||
|
||||
GetStringValue(group, "FBBFilters", FBBString);
|
||||
|
||||
ptr = FBBString;
|
||||
|
||||
// delete old list
|
||||
|
||||
while(Filters && Filters->Next)
|
||||
{
|
||||
FBBFilter * next = Filters->Next;
|
||||
free(Filters);
|
||||
Filters = next;
|
||||
}
|
||||
|
||||
free(Filters);
|
||||
Filters = NULL;
|
||||
|
||||
while (ptr && ptr[0])
|
||||
{
|
||||
FBBFilter * PFilter;
|
||||
|
||||
f.Action = ptr[0];
|
||||
f.Type = ptr[2];
|
||||
ptr = &ptr[4];
|
||||
|
||||
memcpy(f.From, ptr, 10);
|
||||
strlop(f.From, '|');
|
||||
ptr = strlop(ptr, '|');
|
||||
|
||||
memcpy(f.TO, ptr, 10);
|
||||
strlop(f.TO, '|');
|
||||
ptr = strlop(ptr, '|');
|
||||
|
||||
memcpy(f.AT, ptr, 10);
|
||||
strlop(f.AT, '|');
|
||||
ptr = strlop(ptr, '|');
|
||||
|
||||
memcpy(f.BID, ptr, 10);
|
||||
strlop(f.BID, '|');
|
||||
ptr = strlop(ptr, '|');
|
||||
|
||||
f.MaxLen = atoi(ptr);
|
||||
|
||||
// add to list
|
||||
|
||||
f.Next = 0;
|
||||
|
||||
PFilter = zalloc(sizeof(FBBFilter));
|
||||
|
||||
memcpy(PFilter, &f, sizeof(FBBFilter));
|
||||
|
||||
if (Filters == 0)
|
||||
Filters = PFilter;
|
||||
else
|
||||
{
|
||||
FBBFilter * p = Filters;
|
||||
|
||||
while (p->Next)
|
||||
p = p->Next;
|
||||
|
||||
p->Next = PFilter;
|
||||
}
|
||||
|
||||
ptr = strlop(ptr, '|');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//f.Action, f.Type, f.From, f.TO, f.AT, f.BID, &f.MaxLen);
|
||||
|
||||
/* while (p)
|
||||
{
|
||||
ptr += sprintf(ptr, "%c|%c|%s|%s|%s|%s|%d|",
|
||||
p->Action, p->Type, p->From, p->TO, p->AT, p->BID, p->MaxLen);
|
||||
|
||||
p = p->Next;
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
// Send WP Params
|
||||
|
||||
SendWP = GetIntValue(group, "SendWP");
|
||||
|
|
14926
BBSUtilities.c.bak
14926
BBSUtilities.c.bak
File diff suppressed because it is too large
Load Diff
12
BPQINP3.c
12
BPQINP3.c
|
@ -35,6 +35,9 @@ along with LinBPQ/BPQ32. If not, see http://www.gnu.org/licenses
|
|||
#include <fcntl.h>
|
||||
//#include "vmm.h"
|
||||
|
||||
uint64_t timeLoadedMS = 0;
|
||||
|
||||
|
||||
static VOID SendNetFrame(struct ROUTE * Route, struct _L3MESSAGEBUFFER * Frame)
|
||||
{
|
||||
// INP3 should only ever send over an active link, so just queue the message
|
||||
|
@ -320,7 +323,7 @@ VOID ProcessRTTReply(struct ROUTE * Route, struct _L3MESSAGEBUFFER * Buff)
|
|||
Route->Timeout = 0; // Got Response
|
||||
|
||||
sscanf(&Buff->L4DATA[6], "%d", &OrigTime);
|
||||
RTT = GetTickCount() - OrigTime;
|
||||
RTT = (GetTickCount() - timeLoadedMS) - OrigTime;
|
||||
|
||||
if (RTT > 60000)
|
||||
return; // Ignore if more than 60 secs
|
||||
|
@ -379,6 +382,11 @@ VOID ProcessINP3RIF(struct ROUTE * Route, UCHAR * ptr1, int msglen, int Port)
|
|||
rtt = (*ptr1++ << 8);
|
||||
rtt += *ptr1++;
|
||||
|
||||
// rtt is value from remote node. Add our RTT to that node and update hops
|
||||
|
||||
rtt += Route->SRTT;
|
||||
hops++;
|
||||
|
||||
msglen -= 10;
|
||||
|
||||
while (*ptr1 && msglen > 0)
|
||||
|
@ -766,7 +774,7 @@ VOID SendRTTMsg(struct ROUTE * Route)
|
|||
Msg->L4FLAGS = L4INFO;
|
||||
|
||||
|
||||
sprintf(Stamp, "%10d %10d %10d %10d ", GetTickCount(), Route->SRTT/10, Route->RTT/10, 0);
|
||||
sprintf(Stamp, "%10llu %10d %10d %10d ", (GetTickCount() - timeLoadedMS), Route->SRTT/10, Route->RTT/10, 0);
|
||||
memcpy(RTTMsg.TXTIME, Stamp, 44);
|
||||
|
||||
memcpy(Msg->L4DATA, &RTTMsg, 236);
|
||||
|
|
BIN
BPQMail.aps
BIN
BPQMail.aps
Binary file not shown.
|
@ -1118,6 +1118,9 @@
|
|||
// Fix recently introduced crash when "Don't allow new users" is set (81)
|
||||
// Skip comments before TIMES at start of Connect Script (83)
|
||||
|
||||
// 6.0.25.1 ??
|
||||
|
||||
// Aff FBB reject.sys style filters (3)
|
||||
|
||||
#include "bpqmail.h"
|
||||
#include "winstdint.h"
|
||||
|
|
3651
BPQMail.c.bak
3651
BPQMail.c.bak
File diff suppressed because it is too large
Load Diff
46
BPQMail.rc
46
BPQMail.rc
|
@ -254,7 +254,7 @@ END
|
|||
IDD_USEREDIT DIALOGEX 20, 20, 293, 281
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Edit User"
|
||||
FONT 8, "System"
|
||||
FONT 8, "System", 0, 0, 0x1
|
||||
BEGIN
|
||||
COMBOBOX 5000,7,10,57,123,CBS_SIMPLE | CBS_SORT | CBS_UPPERCASE |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
|
@ -1072,39 +1072,45 @@ BEGIN
|
|||
ES_AUTOHSCROLL
|
||||
END
|
||||
|
||||
FILTERS DIALOG DISCARDABLE 26, 5, 382, 287
|
||||
FILTERS DIALOG DISCARDABLE 26, 5, 382, 371
|
||||
STYLE WS_CHILD | WS_VISIBLE
|
||||
FONT 8, "System"
|
||||
BEGIN
|
||||
LTEXT "Reject Messages:",IDC_STATIC,162,29,70,10
|
||||
LTEXT "From",IDC_STATIC,83,155,28,10
|
||||
EDITTEXT IDC_HOLDFROM,58,167,64,83,ES_MULTILINE | ES_UPPERCASE |
|
||||
LTEXT "Reject Messages:",IDC_STATIC,162,26,70,10
|
||||
LTEXT "From",IDC_STATIC,83,137,28,10
|
||||
EDITTEXT IDC_HOLDFROM,58,149,64,83,ES_MULTILINE | ES_UPPERCASE |
|
||||
ES_AUTOVSCROLL | ES_WANTRETURN
|
||||
LTEXT "To",IDC_STATIC,152,155,27,10
|
||||
EDITTEXT IDC_HOLDTO,126,167,64,83,ES_MULTILINE | ES_UPPERCASE |
|
||||
LTEXT "To",IDC_STATIC,152,137,27,10
|
||||
EDITTEXT IDC_HOLDTO,126,149,64,83,ES_MULTILINE | ES_UPPERCASE |
|
||||
ES_AUTOVSCROLL | ES_WANTRETURN
|
||||
LTEXT "At",IDC_STATIC,223,155,15,10
|
||||
EDITTEXT IDC_HOLDAT,194,167,64,83,ES_MULTILINE | ES_UPPERCASE |
|
||||
LTEXT "At",IDC_STATIC,223,137,15,10
|
||||
EDITTEXT IDC_HOLDAT,194,149,64,83,ES_MULTILINE | ES_UPPERCASE |
|
||||
ES_AUTOVSCROLL | ES_WANTRETURN
|
||||
DEFPUSHBUTTON "Save",IDC_FILTERSAVE,171,266,50,14,BS_CENTER |
|
||||
DEFPUSHBUTTON "Save",IDC_FILTERSAVE,171,341,50,14,BS_CENTER |
|
||||
BS_VCENTER
|
||||
LTEXT "From",IDC_STATIC,83,40,28,10
|
||||
EDITTEXT IDC_REJFROM,58,52,64,83,ES_MULTILINE | ES_UPPERCASE |
|
||||
EDITTEXT IDC_REJFROM,58,52,64,67,ES_MULTILINE | ES_UPPERCASE |
|
||||
ES_AUTOVSCROLL | ES_WANTRETURN
|
||||
LTEXT "To",IDC_STATIC,154,40,27,10
|
||||
EDITTEXT IDC_REJTO,126,52,64,83,ES_MULTILINE | ES_UPPERCASE |
|
||||
EDITTEXT IDC_REJTO,126,52,64,68,ES_MULTILINE | ES_UPPERCASE |
|
||||
ES_AUTOVSCROLL | ES_WANTRETURN
|
||||
LTEXT "At",IDC_STATIC,223,40,15,10
|
||||
EDITTEXT IDC_REJAT,194,52,64,83,ES_MULTILINE | ES_UPPERCASE |
|
||||
EDITTEXT IDC_REJAT,194,52,64,68,ES_MULTILINE | ES_UPPERCASE |
|
||||
ES_AUTOVSCROLL | ES_WANTRETURN
|
||||
LTEXT "Message Filtering Setup.",IDC_STATIC,152,10,95,15
|
||||
LTEXT "Hold Messages:",IDC_STATIC,166,143,60,9
|
||||
EDITTEXT IDC_REJBID,262,52,64,83,ES_MULTILINE | ES_UPPERCASE |
|
||||
LTEXT "Hold Messages:",IDC_STATIC,166,128,60,9
|
||||
EDITTEXT IDC_REJBID,262,52,64,68,ES_MULTILINE | ES_UPPERCASE |
|
||||
ES_AUTOVSCROLL | ES_WANTRETURN
|
||||
EDITTEXT IDC_HOLDBID,262,167,64,83,ES_MULTILINE | ES_UPPERCASE |
|
||||
EDITTEXT IDC_HOLDBID,262,149,64,83,ES_MULTILINE | ES_UPPERCASE |
|
||||
ES_AUTOVSCROLL | ES_WANTRETURN
|
||||
LTEXT "BID",IDC_STATIC,289,155,15,10
|
||||
LTEXT "BID",IDC_STATIC,289,137,15,10
|
||||
LTEXT "BID",IDC_STATIC,289,41,15,10
|
||||
EDITTEXT IDC_REJSYS,58,265,270,66,ES_MULTILINE | ES_UPPERCASE |
|
||||
ES_AUTOVSCROLL | ES_WANTRETURN
|
||||
LTEXT "Composite Rules (like fbb reject.sys)",IDC_STATIC,152,
|
||||
236,134,9
|
||||
LTEXT "Action, Type, from, @BBS, to, BID, maximum size",
|
||||
IDC_STATIC,59,251,247,9
|
||||
END
|
||||
|
||||
WPUPDATE DIALOG DISCARDABLE 26, 5, 382, 287
|
||||
|
@ -1258,6 +1264,7 @@ BEGIN
|
|||
"FILTERS", DIALOG
|
||||
BEGIN
|
||||
RIGHTMARGIN, 377
|
||||
BOTTOMMARGIN, 355
|
||||
END
|
||||
|
||||
IDD_RMSBULLDLG, DIALOG
|
||||
|
@ -1444,6 +1451,11 @@ BEGIN
|
|||
0x0000
|
||||
END
|
||||
|
||||
FILTERS AFX_DIALOG_LAYOUT MOVEABLE PURE
|
||||
BEGIN
|
||||
0x0000
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
|
|
@ -68,7 +68,7 @@
|
|||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="..\lib\bpq32.lib wsock32.lib comctl32.lib winmm.lib ..\lib\libconfig.lib DbgHelp.lib"
|
||||
OutputFile="c:\DevProgs\bpq32\BPQMail.exe"
|
||||
OutputFile="d:\DevProgs\bpq32\BPQMail.exe"
|
||||
LinkIncremental="2"
|
||||
IgnoreAllDefaultLibraries="false"
|
||||
IgnoreDefaultLibraryNames="LIBCMT"
|
||||
|
|
|
@ -0,0 +1,65 @@
|
|||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioUserFile
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
ShowAllFiles="false"
|
||||
>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<DebugSettings
|
||||
Command="$(TargetPath)"
|
||||
WorkingDirectory=""
|
||||
CommandArguments=""
|
||||
Attach="false"
|
||||
DebuggerType="3"
|
||||
Remote="1"
|
||||
RemoteMachine="DESKTOP-MHE5LO8"
|
||||
RemoteCommand=""
|
||||
HttpUrl=""
|
||||
PDBPath=""
|
||||
SQLDebugging=""
|
||||
Environment=""
|
||||
EnvironmentMerge="true"
|
||||
DebuggerFlavor=""
|
||||
MPIRunCommand=""
|
||||
MPIRunArguments=""
|
||||
MPIRunWorkingDirectory=""
|
||||
ApplicationCommand=""
|
||||
ApplicationArguments=""
|
||||
ShimCommand=""
|
||||
MPIAcceptMode=""
|
||||
MPIAcceptFilter=""
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<DebugSettings
|
||||
Command="$(TargetPath)"
|
||||
WorkingDirectory=""
|
||||
CommandArguments=""
|
||||
Attach="false"
|
||||
DebuggerType="3"
|
||||
Remote="1"
|
||||
RemoteMachine="DESKTOP-MHE5LO8"
|
||||
RemoteCommand=""
|
||||
HttpUrl=""
|
||||
PDBPath=""
|
||||
SQLDebugging=""
|
||||
Environment=""
|
||||
EnvironmentMerge="true"
|
||||
DebuggerFlavor=""
|
||||
MPIRunCommand=""
|
||||
MPIRunArguments=""
|
||||
MPIRunWorkingDirectory=""
|
||||
ApplicationCommand=""
|
||||
ApplicationArguments=""
|
||||
ShimCommand=""
|
||||
MPIAcceptMode=""
|
||||
MPIAcceptFilter=""
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
</VisualStudioUserFile>
|
141
BPQMail.vcxproj
141
BPQMail.vcxproj
|
@ -5,23 +5,16 @@
|
|||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{3766AA10-C777-4ED8-A83D-F1452DE9B665}</ProjectGuid>
|
||||
<RootNamespace>TelnetServer</RootNamespace>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
|
@ -30,39 +23,21 @@
|
|||
<CharacterSet>NotSet</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>15.0.28307.799</_ProjectFileVersion>
|
||||
|
@ -72,17 +47,11 @@
|
|||
<IntDir>C:\Dev\Msdev2005\Intermed\$(SolutionName)\$(ProjectName)\$(Configuration)\</IntDir>
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<OutDir>C:\Dev\Msdev2005\$(SolutionName)\$(ProjectName)\$(Configuration)\</OutDir>
|
||||
<IntDir>C:\Dev\Msdev2005\Intermed\$(SolutionName)\$(ProjectName)\$(Configuration)\</IntDir>
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<CustomBuildStep>
|
||||
<Command />
|
||||
|
@ -117,40 +86,6 @@
|
|||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<CustomBuildStep>
|
||||
<Command>
|
||||
</Command>
|
||||
</CustomBuildStep>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\CKernel;..\CInclude;..\CommonSource;..\BPQMail;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USE_32BIT_TIME_T;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<CompileAs>CompileAsC</CompileAs>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<AdditionalIncludeDirectories>..\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>..\lib\bpq32.lib;wsock32.lib;comctl32.lib;winmm.lib;..\lib\libconfig.lib;DbgHelp.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>c:\DevProgs\bpq32\BPQMail.exe</OutputFile>
|
||||
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
|
||||
<IgnoreSpecificDefaultLibraries>LIBCMT;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile>
|
||||
<GenerateMapFile>true</GenerateMapFile>
|
||||
<MapFileName>$(IntDir)BBSListings\bpqmail.map</MapFileName>
|
||||
<MapExports>true</MapExports>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<PreBuildEvent>
|
||||
<Command />
|
||||
|
@ -186,124 +121,58 @@
|
|||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<PreBuildEvent>
|
||||
<Command>
|
||||
</Command>
|
||||
</PreBuildEvent>
|
||||
<CustomBuildStep>
|
||||
<Command>
|
||||
</Command>
|
||||
</CustomBuildStep>
|
||||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<AdditionalIncludeDirectories>..\CKernel;..\CInclude;..\CommonSource;..\BPQMail;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USE_32BIT_TIME_T;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<CompileAs>CompileAsC</CompileAs>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<AdditionalIncludeDirectories>..\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>..\lib\bpq32.lib;wsock32.lib;comctl32.lib;winmm.lib;..\lib\libconfig.lib;DbgHelp.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>c:\DevProgs\bpq32\BPQMail.exe</OutputFile>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<ProgramDatabaseFile>c:\DevProgs\bpq32\BPQMail.pdb</ProgramDatabaseFile>
|
||||
<GenerateMapFile>true</GenerateMapFile>
|
||||
<MapFileName>c:\DevProgs\bpq32\BPQMail.map</MapFileName>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<LinkTimeCodeGeneration>
|
||||
</LinkTimeCodeGeneration>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Alloc.c" />
|
||||
<ClCompile Include="BBSHTMLConfig.c" />
|
||||
<ClCompile Include="BBSUtilities.c">
|
||||
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)%(Filename)1.obj</ObjectFileName>
|
||||
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)%(Filename)1.obj</ObjectFileName>
|
||||
<XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)%(Filename)1.xdc</XMLDocumentationFileName>
|
||||
<XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)%(Filename)1.xdc</XMLDocumentationFileName>
|
||||
<AssemblerOutput Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">All</AssemblerOutput>
|
||||
<AssemblerOutput Condition="'$(Configuration)|$(Platform)'=='Release|x64'">All</AssemblerOutput>
|
||||
<AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)</AssemblerListingLocation>
|
||||
<AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)</AssemblerListingLocation>
|
||||
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)%(Filename)1.obj</ObjectFileName>
|
||||
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)%(Filename)1.obj</ObjectFileName>
|
||||
<XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)%(Filename)1.xdc</XMLDocumentationFileName>
|
||||
<XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)%(Filename)1.xdc</XMLDocumentationFileName>
|
||||
</ClCompile>
|
||||
<ClCompile Include="BPQMail.c" />
|
||||
<ClCompile Include="BPQMailConfig.c" />
|
||||
<ClCompile Include="CMSAuth.c" />
|
||||
<ClCompile Include="FBBRoutines.c">
|
||||
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)%(Filename)1.obj</ObjectFileName>
|
||||
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)%(Filename)1.obj</ObjectFileName>
|
||||
<XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)%(Filename)1.xdc</XMLDocumentationFileName>
|
||||
<XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)%(Filename)1.xdc</XMLDocumentationFileName>
|
||||
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)%(Filename)1.obj</ObjectFileName>
|
||||
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)%(Filename)1.obj</ObjectFileName>
|
||||
<XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)%(Filename)1.xdc</XMLDocumentationFileName>
|
||||
<XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)%(Filename)1.xdc</XMLDocumentationFileName>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Housekeeping.c" />
|
||||
<ClCompile Include="HTMLCommonCode.c" />
|
||||
<ClCompile Include="LzFind.c" />
|
||||
<ClCompile Include="lzhuf32.c">
|
||||
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)%(Filename)1.obj</ObjectFileName>
|
||||
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)%(Filename)1.obj</ObjectFileName>
|
||||
<XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)%(Filename)1.xdc</XMLDocumentationFileName>
|
||||
<XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)%(Filename)1.xdc</XMLDocumentationFileName>
|
||||
<AssemblerOutput Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">All</AssemblerOutput>
|
||||
<AssemblerOutput Condition="'$(Configuration)|$(Platform)'=='Release|x64'">All</AssemblerOutput>
|
||||
<AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)</AssemblerListingLocation>
|
||||
<AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)</AssemblerListingLocation>
|
||||
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)</ObjectFileName>
|
||||
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)</ObjectFileName>
|
||||
<XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)%(Filename)1.xdc</XMLDocumentationFileName>
|
||||
<XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)%(Filename)1.xdc</XMLDocumentationFileName>
|
||||
</ClCompile>
|
||||
<ClCompile Include="LzmaDec.c" />
|
||||
<ClCompile Include="LzmaEnc.c" />
|
||||
<ClCompile Include="LzmaLib.c" />
|
||||
<ClCompile Include="MailCommands.c">
|
||||
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)%(Filename)1.obj</ObjectFileName>
|
||||
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)%(Filename)1.obj</ObjectFileName>
|
||||
<XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)%(Filename)1.xdc</XMLDocumentationFileName>
|
||||
<XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)%(Filename)1.xdc</XMLDocumentationFileName>
|
||||
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)%(Filename)1.obj</ObjectFileName>
|
||||
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)%(Filename)1.obj</ObjectFileName>
|
||||
<XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)%(Filename)1.xdc</XMLDocumentationFileName>
|
||||
<XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)%(Filename)1.xdc</XMLDocumentationFileName>
|
||||
</ClCompile>
|
||||
<ClCompile Include="MailDataDefs.c" />
|
||||
<ClCompile Include="MailRouting.c">
|
||||
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)%(Filename)1.obj</ObjectFileName>
|
||||
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)%(Filename)1.obj</ObjectFileName>
|
||||
<XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)%(Filename)1.xdc</XMLDocumentationFileName>
|
||||
<XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)%(Filename)1.xdc</XMLDocumentationFileName>
|
||||
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)%(Filename)1.obj</ObjectFileName>
|
||||
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)%(Filename)1.obj</ObjectFileName>
|
||||
<XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)%(Filename)1.xdc</XMLDocumentationFileName>
|
||||
<XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)%(Filename)1.xdc</XMLDocumentationFileName>
|
||||
</ClCompile>
|
||||
<ClCompile Include="MailTCP.c">
|
||||
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)%(Filename)1.obj</ObjectFileName>
|
||||
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)%(Filename)1.obj</ObjectFileName>
|
||||
<XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)%(Filename)1.xdc</XMLDocumentationFileName>
|
||||
<XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)%(Filename)1.xdc</XMLDocumentationFileName>
|
||||
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)%(Filename)1.obj</ObjectFileName>
|
||||
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)%(Filename)1.obj</ObjectFileName>
|
||||
<XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)%(Filename)1.xdc</XMLDocumentationFileName>
|
||||
<XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)%(Filename)1.xdc</XMLDocumentationFileName>
|
||||
</ClCompile>
|
||||
<ClCompile Include="MBLRoutines.c" />
|
||||
<ClCompile Include="Monitor.c" />
|
||||
|
@ -312,25 +181,17 @@
|
|||
<ClCompile Include="NNTPRoutines.c" />
|
||||
<ClCompile Include="UIRoutines.c">
|
||||
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)%(Filename)1.obj</ObjectFileName>
|
||||
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)%(Filename)1.obj</ObjectFileName>
|
||||
<XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)%(Filename)1.xdc</XMLDocumentationFileName>
|
||||
<XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)%(Filename)1.xdc</XMLDocumentationFileName>
|
||||
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)%(Filename)1.obj</ObjectFileName>
|
||||
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)%(Filename)1.obj</ObjectFileName>
|
||||
<XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)%(Filename)1.xdc</XMLDocumentationFileName>
|
||||
<XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)%(Filename)1.xdc</XMLDocumentationFileName>
|
||||
</ClCompile>
|
||||
<ClCompile Include="utf8Routines.c" />
|
||||
<ClCompile Include="WebMail.c" />
|
||||
<ClCompile Include="WPRoutines.c">
|
||||
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)%(Filename)1.obj</ObjectFileName>
|
||||
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)%(Filename)1.obj</ObjectFileName>
|
||||
<XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)%(Filename)1.xdc</XMLDocumentationFileName>
|
||||
<XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)%(Filename)1.xdc</XMLDocumentationFileName>
|
||||
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)%(Filename)1.obj</ObjectFileName>
|
||||
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)%(Filename)1.obj</ObjectFileName>
|
||||
<XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)%(Filename)1.xdc</XMLDocumentationFileName>
|
||||
<XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)%(Filename)1.xdc</XMLDocumentationFileName>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
|
|
@ -255,6 +255,8 @@
|
|||
#define IDC_REJFROM 7077
|
||||
#define IDC_REJTO 7078
|
||||
#define IDC_REJAT 7079
|
||||
#define IDC_HOLDFROM2 7080
|
||||
#define IDC_REJSYS 7080
|
||||
#define IDM_HOUSEKEEPING 9000
|
||||
#define IDM_PR 9001
|
||||
#define IDM_PUR 9002
|
||||
|
@ -322,7 +324,7 @@
|
|||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 30012
|
||||
#define _APS_NEXT_RESOURCE_VALUE 30013
|
||||
#define _APS_NEXT_COMMAND_VALUE 40027
|
||||
#define _APS_NEXT_CONTROL_VALUE 1093
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
|
|
20
Bpq32.c
20
Bpq32.c
|
@ -1183,6 +1183,17 @@ along with LinBPQ/BPQ32. If not, see http://www.gnu.org/licenses
|
|||
// Version 6.0.25.?
|
||||
|
||||
// Fix 64 bit compatibility problems in SCSTracker and UZ7HO drivers
|
||||
// Add Chat PACLEN config (5)
|
||||
// Fix NC to Application Call (6)
|
||||
// Fix INP3 L3RTT messages on Linux and correct RTT calculation (9)
|
||||
// Get Beacon config from config file on Windows (9)
|
||||
// fix processing DED TNC Emulator M command with space between M and params (10)
|
||||
// Fix sending UI frames on SCSPACTOR (11)
|
||||
// Dont allow ports that can't set digi'ed bit in callsigns to digipeat. (11)
|
||||
// Add SDRAngel rig control (11)
|
||||
// Add option to specify config and data directories on linbpq (12)
|
||||
// Allow zero resptime (send RR immediately) (13)
|
||||
// Fix corruptions in Webmail on 64 bit builds, eg in displaying 7+ files (15)
|
||||
|
||||
#define CKernel
|
||||
|
||||
|
@ -1408,6 +1419,10 @@ extern char MAPCOMMENT[]; // Locator for Reporting - may be Maidenhead or LAT:L
|
|||
extern char LOC[7]; // Maidenhead Locator for Reporting
|
||||
extern char ReportDest[7];
|
||||
|
||||
extern UCHAR ConfigDirectory[260];
|
||||
|
||||
extern uint64_t timeLoadedMS;
|
||||
|
||||
VOID __cdecl Debugprintf(const char * format, ...);
|
||||
VOID __cdecl Consoleprintf(const char * format, ...);
|
||||
|
||||
|
@ -2290,6 +2305,9 @@ FirstInit()
|
|||
GetModuleFileNameExPtr = (FARPROCX)GetProcAddress(ExtDriver,"GetModuleFileNameExA");
|
||||
EnumProcessesPtr = (FARPROCX)GetProcAddress(ExtDriver,"EnumProcesses");
|
||||
}
|
||||
|
||||
timeLoadedMS = GetTickCount();
|
||||
|
||||
INITIALISEPORTS();
|
||||
|
||||
OpenReportingSockets();
|
||||
|
@ -3269,6 +3287,8 @@ if (_winver < 0x0600)
|
|||
RegCloseKey(hKey);
|
||||
}
|
||||
|
||||
strcpy(ConfigDirectory, BPQDirectory);
|
||||
|
||||
if (LogDirectory[0] == 0)
|
||||
strcpy(LogDirectory, BPQDirectory);
|
||||
|
||||
|
|
BIN
CBPQ32.suo
BIN
CBPQ32.suo
Binary file not shown.
|
@ -20,7 +20,7 @@
|
|||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="C:\Dev\Msdev2005\$(SolutionName)\$(ProjectName)\$(ConfigurationName)"
|
||||
OutputDirectory="d:\devprogs\bpq32"
|
||||
IntermediateDirectory="C:\Dev\Msdev2005\Intermed\$(SolutionName)\$(ProjectName)\$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="0"
|
||||
|
@ -180,7 +180,7 @@
|
|||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalOptions=" /section:_BPQDATA,srw"
|
||||
AdditionalDependencies="WS2_32.Lib winmm.lib DbgHelp.lib comctl32.lib setupapi.lib ..\lib\libconfig.lib miniupnpc.lib zlibstat.lib"
|
||||
AdditionalDependencies="WS2_32.Lib winmm.lib comctl32.lib setupapi.lib ..\lib\libconfig.lib miniupnpc.lib zlibstat.lib DbgHelp.lib"
|
||||
OutputFile="C:\DevProgs\BPQ32\bpq32.dll"
|
||||
LinkIncremental="1"
|
||||
IgnoreDefaultLibraryNames=""
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
Name="Debug|Win32"
|
||||
>
|
||||
<DebugSettings
|
||||
Command=""
|
||||
Command="c:\devprogs\bpq32\bpq32.exe"
|
||||
WorkingDirectory=""
|
||||
CommandArguments=""
|
||||
Attach="false"
|
||||
|
@ -22,7 +22,7 @@
|
|||
SQLDebugging=""
|
||||
Environment=""
|
||||
EnvironmentMerge="true"
|
||||
DebuggerFlavor=""
|
||||
DebuggerFlavor="0"
|
||||
MPIRunCommand=""
|
||||
MPIRunArguments=""
|
||||
MPIRunWorkingDirectory=""
|
||||
|
|
|
@ -37,6 +37,7 @@ extern char OurNode[10];
|
|||
|
||||
extern char PassError[];
|
||||
extern char BusyError[];
|
||||
extern int chatPaclen;
|
||||
|
||||
extern char NodeTail[];
|
||||
extern BOOL APRSApplConnected;
|
||||
|
@ -317,6 +318,10 @@ VOID SaveChatInfo(struct HTTPConnectionInfo * Session, char * MsgPtr, char * Rep
|
|||
ChatApplNum = atoi(Temp);
|
||||
GetParam(input, "Streams=", Temp);
|
||||
MaxChatStreams = atoi(Temp);
|
||||
GetParam(input, "Paclen=", Temp);
|
||||
chatPaclen = atoi(Temp);
|
||||
if (chatPaclen < 60)
|
||||
chatPaclen = 60;
|
||||
|
||||
GetParam(input, "nodes=", Nodes);
|
||||
|
||||
|
@ -503,7 +508,7 @@ scan:
|
|||
|
||||
Len = sprintf(Reply, ChatConfigTemplate,
|
||||
OurNode, Key, Key, Key,
|
||||
ChatApplNum, MaxChatStreams, Nodes, Position,
|
||||
ChatApplNum, MaxChatStreams, Nodes, chatPaclen, Position,
|
||||
(PopupMode) ? UNC : CHKD,
|
||||
(PopupMode) ? CHKD : UNC, Text, ptr2);
|
||||
|
||||
|
@ -520,9 +525,9 @@ VOID SendChatStatusPage(char * Reply, int * ReplyLen, char * Key)
|
|||
char * Topic;
|
||||
LINK *link;
|
||||
|
||||
char Streams[8192];
|
||||
char Users[8192];
|
||||
char Links[8192];
|
||||
char Streams[65536];
|
||||
char Users[65536];
|
||||
char Links[65536];
|
||||
|
||||
ChatCIRCUIT * conn;
|
||||
int i = 0, n;
|
||||
|
|
|
@ -16,6 +16,7 @@ extern int NumberofChatStreams;
|
|||
|
||||
extern char ChatConfigName[MAX_PATH];
|
||||
extern char Session[20];
|
||||
extern int chatPaclen;
|
||||
|
||||
extern struct SEM ChatSemaphore;
|
||||
extern struct SEM AllocSemaphore;
|
||||
|
@ -67,7 +68,7 @@ int Connected(int Stream)
|
|||
|
||||
if (conn->rtcflags == p_linkini)
|
||||
{
|
||||
conn->paclen = 236;
|
||||
conn->paclen = chatPaclen;
|
||||
|
||||
// Run first line of connect script
|
||||
|
||||
|
@ -86,8 +87,10 @@ int Connected(int Stream)
|
|||
conn->Secure_Session = GetConnectionInfo(Stream, callsign,
|
||||
&port, &conn->SessType, &paclen, &maxframe, &l4window);
|
||||
|
||||
conn->paclen = paclen;
|
||||
if (paclen > chatPaclen || paclen == 0)
|
||||
paclen = chatPaclen;
|
||||
|
||||
conn->paclen = paclen;
|
||||
strlop(callsign, ' '); // Remove trailing spaces
|
||||
|
||||
memcpy(conn->Callsign, callsign, 10);
|
||||
|
|
5599
Cmd-HPLaptop-2.c
5599
Cmd-HPLaptop-2.c
File diff suppressed because it is too large
Load Diff
5495
Cmd-HPLaptop.c
5495
Cmd-HPLaptop.c
File diff suppressed because it is too large
Load Diff
9
Cmd.c
9
Cmd.c
|
@ -3676,6 +3676,13 @@ VOID MHCMD(TRANSPORTENTRY * Session, char * Bufferptr, char * CmdTail, CMDX * CM
|
|||
|
||||
ptr = strtok_s(CmdTail, " ", &Context);
|
||||
|
||||
if (ptr == NULL || ptr[0] == 0)
|
||||
{
|
||||
Bufferptr = Cmdprintf(Session, Bufferptr, "Port Number needed eg MH 1\r");
|
||||
SendCommandReply(Session, REPLYBUFFER, (int)(Bufferptr - (char *)REPLYBUFFER));
|
||||
return;
|
||||
}
|
||||
|
||||
if (ptr)
|
||||
Port = atoi(ptr);
|
||||
|
||||
|
@ -4137,7 +4144,7 @@ VOID ATTACHCMD(TRANSPORTENTRY * Session, char * Bufferptr, char * CmdTail, CMDX
|
|||
if (OtherTNC == TNC)
|
||||
continue;
|
||||
|
||||
if (rxInterlock == OtherTNC->RXRadio || txInterlock == OtherTNC->TXRadio) // Same Group
|
||||
if (rxInterlock && rxInterlock == OtherTNC->RXRadio || txInterlock && txInterlock == OtherTNC->TXRadio) // Same Group
|
||||
{
|
||||
int n;
|
||||
|
||||
|
|
622
CommonCode.c
622
CommonCode.c
|
@ -68,7 +68,11 @@ VOID WriteMiniDump();
|
|||
void printStack(void);
|
||||
char * FormatMH(PMHSTRUC MH, char Format);
|
||||
void WriteConnectLog(char * fromCall, char * toCall, UCHAR * Mode);
|
||||
void SendDataToPktMap(char *Msg);
|
||||
|
||||
extern BOOL LogAllConnects;
|
||||
extern BOOL M0LTEMap;
|
||||
|
||||
|
||||
extern VOID * ENDBUFFERPOOL;
|
||||
|
||||
|
@ -2095,9 +2099,28 @@ DllExport struct PORTCONTROL * APIENTRY GetPortTableEntryFromSlot(int portslot)
|
|||
return PORTVEC;
|
||||
}
|
||||
|
||||
int CanPortDigi(int Port)
|
||||
{
|
||||
struct PORTCONTROL * PORTVEC = GetPortTableEntryFromPortNum(Port);
|
||||
struct TNCINFO * TNC;
|
||||
|
||||
if (PORTVEC == NULL)
|
||||
return FALSE;
|
||||
|
||||
TNC = PORTVEC->TNC;
|
||||
|
||||
if (TNC == NULL)
|
||||
return TRUE;
|
||||
|
||||
if (TNC->Hardware == H_SCS || TNC->Hardware == H_TRK || TNC->Hardware == H_TRKM || TNC->Hardware == H_WINRPR)
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
struct PORTCONTROL * APIENTRY GetPortTableEntryFromPortNum(int portnum)
|
||||
{
|
||||
struct PORTCONTROL * PORTVEC=PORTTABLE;
|
||||
struct PORTCONTROL * PORTVEC = PORTTABLE;
|
||||
|
||||
do
|
||||
{
|
||||
|
@ -2337,6 +2360,13 @@ BOOL WriteCOMBlock(HANDLE fd, char * Block, int BytesToWrite)
|
|||
DWORD BytesWritten;
|
||||
DWORD ErrorFlags;
|
||||
COMSTAT ComStat;
|
||||
DWORD Mask = 0;
|
||||
int Err;
|
||||
|
||||
Err = GetCommModemStatus(fd, &Mask);
|
||||
|
||||
if ((Mask & MS_CTS_ON) == 0) // trap com0com other end not open
|
||||
return TRUE;
|
||||
|
||||
fWriteStat = WriteFile(fd, Block, BytesToWrite,
|
||||
&BytesWritten, NULL );
|
||||
|
@ -3302,6 +3332,9 @@ VOID SendLocation()
|
|||
|
||||
SendReportMsg((char *)&AXMSG.DEST, Len + 16);
|
||||
|
||||
if (M0LTEMap)
|
||||
SendDataToPktMap("");
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
@ -4088,10 +4121,10 @@ VOID SaveUIConfig()
|
|||
config_destroy(&cfg);
|
||||
}
|
||||
|
||||
int GetRegConfig();
|
||||
|
||||
VOID GetUIConfig()
|
||||
{
|
||||
#ifdef LINBPQ
|
||||
|
||||
char Key[100];
|
||||
char CfgFN[256];
|
||||
char Digis[100];
|
||||
|
@ -4118,7 +4151,13 @@ VOID GetUIConfig()
|
|||
|
||||
if (stat(CfgFN, &STAT) == -1)
|
||||
{
|
||||
// No file. If Windows try to read from registy
|
||||
|
||||
#ifndef LINBPQ
|
||||
GetRegConfig();
|
||||
#else
|
||||
Debugprintf("UIUtil Config File not found\n");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -4158,8 +4197,42 @@ VOID GetUIConfig()
|
|||
}
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
_beginthread(UIThread, 0, NULL);
|
||||
|
||||
}
|
||||
|
||||
#ifndef LINBPQ
|
||||
|
||||
int GetIntValue(config_setting_t * group, char * name)
|
||||
{
|
||||
config_setting_t *setting;
|
||||
|
||||
setting = config_setting_get_member (group, name);
|
||||
if (setting)
|
||||
return config_setting_get_int (setting);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
BOOL GetStringValue(config_setting_t * group, char * name, char * value)
|
||||
{
|
||||
const char * str;
|
||||
config_setting_t *setting;
|
||||
|
||||
setting = config_setting_get_member (group, name);
|
||||
if (setting)
|
||||
{
|
||||
str = config_setting_get_string (setting);
|
||||
strcpy(value, str);
|
||||
return TRUE;
|
||||
}
|
||||
value[0] = 0;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
int GetRegConfig()
|
||||
{
|
||||
int retCode, Vallen, Type, i;
|
||||
char Key[80];
|
||||
char Size[80];
|
||||
|
@ -4234,14 +4307,9 @@ VOID GetUIConfig()
|
|||
|
||||
SaveUIConfig();
|
||||
|
||||
#endif
|
||||
|
||||
_beginthread(UIThread, 0, NULL);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#ifndef LINBPQ
|
||||
|
||||
INT_PTR CALLBACK ChildDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
// This processes messages from controls on the tab subpages
|
||||
|
@ -4749,6 +4817,540 @@ void GetPortCTEXT(TRANSPORTENTRY * Session, char * Bufferptr, char * CmdTail, CM
|
|||
Debugprintf("CTEXT Read for ports %s\r", &PortList[1]);
|
||||
}
|
||||
|
||||
SOCKET OpenHTTPSock(char * Host)
|
||||
{
|
||||
SOCKET sock = 0;
|
||||
struct sockaddr_in destaddr;
|
||||
struct sockaddr_in sinx;
|
||||
int addrlen=sizeof(sinx);
|
||||
struct hostent * HostEnt;
|
||||
int err;
|
||||
u_long param=1;
|
||||
BOOL bcopt=TRUE;
|
||||
|
||||
destaddr.sin_family = AF_INET;
|
||||
destaddr.sin_port = htons(80);
|
||||
|
||||
// Resolve name to address
|
||||
|
||||
HostEnt = gethostbyname (Host);
|
||||
|
||||
if (!HostEnt)
|
||||
{
|
||||
err = WSAGetLastError();
|
||||
|
||||
Debugprintf("Resolve Failed for %s %d %x", "api.winlink.org", err, err);
|
||||
return 0 ; // Resolve failed
|
||||
}
|
||||
|
||||
memcpy(&destaddr.sin_addr.s_addr,HostEnt->h_addr,4);
|
||||
|
||||
// Allocate a Socket entry
|
||||
|
||||
sock = socket(AF_INET,SOCK_STREAM,0);
|
||||
|
||||
if (sock == INVALID_SOCKET)
|
||||
return 0;
|
||||
|
||||
setsockopt (sock, SOL_SOCKET, SO_REUSEADDR, (const char FAR *)&bcopt,4);
|
||||
|
||||
sinx.sin_family = AF_INET;
|
||||
sinx.sin_addr.s_addr = INADDR_ANY;
|
||||
sinx.sin_port = 0;
|
||||
|
||||
if (bind(sock, (struct sockaddr *) &sinx, addrlen) != 0 )
|
||||
return FALSE;
|
||||
|
||||
if (connect(sock,(struct sockaddr *) &destaddr, sizeof(destaddr)) != 0)
|
||||
{
|
||||
err=WSAGetLastError();
|
||||
closesocket(sock);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return sock;
|
||||
}
|
||||
|
||||
static char HeaderTemplate[] = "POST %s HTTP/1.1\r\n"
|
||||
"Accept: application/json\r\n"
|
||||
// "Accept-Encoding: gzip,deflate,gzip, deflate\r\n"
|
||||
"Content-Type: application/json\r\n"
|
||||
"Host: %s:%d\r\n"
|
||||
"Content-Length: %d\r\n"
|
||||
//r\nUser-Agent: BPQ32(G8BPQ)\r\n"
|
||||
// "Expect: 100-continue\r\n"
|
||||
"\r\n";
|
||||
|
||||
|
||||
VOID SendWebRequest(SOCKET sock, char * Host, char * Request, char * Params, int Len, char * Return)
|
||||
{
|
||||
int InputLen = 0;
|
||||
int inptr = 0;
|
||||
char Buffer[4096];
|
||||
char Header[256];
|
||||
char * ptr, * ptr1;
|
||||
int Sent;
|
||||
|
||||
sprintf(Header, HeaderTemplate, Request, Host, 80, Len, Params);
|
||||
Sent = send(sock, Header, (int)strlen(Header), 0);
|
||||
Sent = send(sock, Params, (int)strlen(Params), 0);
|
||||
|
||||
if (Sent == -1)
|
||||
{
|
||||
int Err = WSAGetLastError();
|
||||
Debugprintf("Error %d from Web Update send()", Err);
|
||||
return;
|
||||
}
|
||||
|
||||
while (InputLen != -1)
|
||||
{
|
||||
InputLen = recv(sock, &Buffer[inptr], 4096 - inptr, 0);
|
||||
|
||||
if (InputLen == -1 || InputLen == 0)
|
||||
{
|
||||
int Err = WSAGetLastError();
|
||||
Debugprintf("Error %d from Web Update recv()", Err);
|
||||
return;
|
||||
}
|
||||
|
||||
// As we are using a persistant connection, can't look for close. Check
|
||||
// for complete message
|
||||
|
||||
inptr += InputLen;
|
||||
|
||||
Buffer[inptr] = 0;
|
||||
|
||||
ptr = strstr(Buffer, "\r\n\r\n");
|
||||
|
||||
if (ptr)
|
||||
{
|
||||
// got header
|
||||
|
||||
int Hddrlen = (int)(ptr - Buffer);
|
||||
|
||||
ptr1 = strstr(Buffer, "Content-Length:");
|
||||
|
||||
if (ptr1)
|
||||
{
|
||||
// Have content length
|
||||
|
||||
int ContentLen = atoi(ptr1 + 16);
|
||||
|
||||
if (ContentLen + Hddrlen + 4 == inptr)
|
||||
{
|
||||
// got whole response
|
||||
|
||||
if (strstr(Buffer, " 200 OK"))
|
||||
{
|
||||
if (Return)
|
||||
{
|
||||
memcpy(Return, ptr + 4, ContentLen);
|
||||
Return[ContentLen] = 0;
|
||||
}
|
||||
else
|
||||
Debugprintf("Map Database update ok");
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
strlop(Buffer, 13);
|
||||
Debugprintf("Map Update Params - %s", Params);
|
||||
Debugprintf("Map Update failed - %s", Buffer);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ptr1 = strstr(_strlwr(Buffer), "transfer-encoding:");
|
||||
|
||||
if (ptr1)
|
||||
{
|
||||
// Just accept anything until I've sorted things with Lee
|
||||
Debugprintf("%s", ptr1);
|
||||
Debugprintf("Web Database update ok");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// https://packetnodes.spots.radio/api/NodeData/{callsign}
|
||||
|
||||
//SendHTTPRequest(sock, "/account/exists", Message, Len, Response);
|
||||
|
||||
#include "kiss.h"
|
||||
|
||||
extern char MYALIASLOPPED[10];
|
||||
extern int MasterPort[MAXBPQPORTS+1];
|
||||
|
||||
void SendDataToPktMap(char *Msg)
|
||||
{
|
||||
SOCKET sock;
|
||||
char Return[256];
|
||||
char Request[64];
|
||||
char Params[50000];
|
||||
struct PORTCONTROL * PORT = PORTTABLE;
|
||||
struct PORTCONTROL * SAVEPORT;
|
||||
struct ROUTE * Routes = NEIGHBOURS;
|
||||
int MaxRoutes = MAXNEIGHBOURS;
|
||||
|
||||
int PortNo;
|
||||
int Active;
|
||||
uint64_t Freq;
|
||||
int Baud;
|
||||
int Bitrate;
|
||||
char * Mode;
|
||||
char * Use;
|
||||
char * Type;
|
||||
char * Modulation;
|
||||
|
||||
char locked[] = " ! ";
|
||||
int Percent = 0;
|
||||
int Port = 0;
|
||||
char Normcall[10];
|
||||
char Copy[20];
|
||||
|
||||
char * ptr = Params;
|
||||
|
||||
printf("Sending to new map\n");
|
||||
|
||||
sprintf(Request, "/api/NodeData/%s", MYNODECALL);
|
||||
|
||||
// https://packetnodes.spots.radio/swagger/index.html
|
||||
|
||||
// This builds the request and sends it
|
||||
|
||||
// Minimum header seems to be
|
||||
|
||||
// "nodeAlias": "BPQ",
|
||||
// "location": {"locator": "IO68VL"},
|
||||
// "software": {"name": "BPQ32","version": "6.0.24.3"},
|
||||
|
||||
ptr += sprintf(ptr, "{\"nodeAlias\": \"%s\",\r\n", MYALIASLOPPED);
|
||||
|
||||
if (strlen(LOCATOR) == 6)
|
||||
ptr += sprintf(ptr, "\"location\": {\"locator\": \"%s\"},\r\n", LOCATOR);
|
||||
else
|
||||
{
|
||||
// Lat Lon
|
||||
|
||||
double myLat, myLon;
|
||||
char LocCopy[80];
|
||||
char * context;
|
||||
|
||||
strcpy(LocCopy, LOCATOR);
|
||||
|
||||
myLat = atof(strtok_s(LocCopy, ",:; ", &context));
|
||||
myLon = atof(context);
|
||||
|
||||
ptr += sprintf(ptr, "\"location\": {\"coords\": {\"lat\": %f, \"lon\": %f}},\r\n",
|
||||
myLat, myLon);
|
||||
|
||||
}
|
||||
|
||||
#ifdef LINBPQ
|
||||
ptr += sprintf(ptr, "\"software\": {\"name\": \"LINBPQ\",\"version\": \"%s\"},\r\n", VersionString);
|
||||
#else
|
||||
ptr += sprintf(ptr, "\"software\": {\"name\": \"BPQ32\",\"version\": \"%s\"},\r\n", VersionString);
|
||||
#endif
|
||||
ptr += sprintf(ptr, "\"source\": \"ReportedByNode\",\r\n");
|
||||
|
||||
//Ports
|
||||
|
||||
ptr += sprintf(ptr, "\"ports\": [");
|
||||
|
||||
// Get active ports
|
||||
|
||||
while (PORT)
|
||||
{
|
||||
PortNo = PORT->PORTNUMBER;
|
||||
|
||||
if (PORT->Hide)
|
||||
{
|
||||
PORT = PORT->PORTPOINTER;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (PORT->SendtoM0LTEMap == 0)
|
||||
{
|
||||
PORT = PORT->PORTPOINTER;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Try to get port status - may not be possible with some
|
||||
|
||||
if (PORT->PortStopped)
|
||||
{
|
||||
PORT = PORT->PORTPOINTER;
|
||||
continue;
|
||||
}
|
||||
|
||||
Active = 0;
|
||||
Freq = 0;
|
||||
Baud = 0;
|
||||
Mode = "ax.25";
|
||||
Use = "";
|
||||
Type = "RF";
|
||||
Bitrate = 0;
|
||||
Modulation = "FSK";
|
||||
|
||||
if (PORT->PORTTYPE == 0)
|
||||
{
|
||||
struct KISSINFO * KISS = (struct KISSINFO *)PORT;
|
||||
NPASYINFO Port;
|
||||
|
||||
SAVEPORT = PORT;
|
||||
|
||||
if (KISS->FIRSTPORT && KISS->FIRSTPORT != KISS)
|
||||
{
|
||||
// Not first port on device
|
||||
|
||||
PORT = (struct PORTCONTROL *)KISS->FIRSTPORT;
|
||||
Port = KISSInfo[PortNo];
|
||||
}
|
||||
|
||||
Port = KISSInfo[PORT->PORTNUMBER];
|
||||
|
||||
if (Port)
|
||||
{
|
||||
// KISS like - see if connected
|
||||
|
||||
if (PORT->PORTIPADDR.s_addr || PORT->KISSSLAVE)
|
||||
{
|
||||
// KISS over UDP or TCP
|
||||
|
||||
if (PORT->KISSTCP)
|
||||
{
|
||||
if (Port->Connected)
|
||||
Active = 1;
|
||||
}
|
||||
else
|
||||
Active = 1; // UDP - Cant tell
|
||||
}
|
||||
else
|
||||
if (Port->idComDev) // Serial port Open
|
||||
Active = 1;
|
||||
|
||||
PORT = SAVEPORT;
|
||||
}
|
||||
}
|
||||
else if (PORT->PORTTYPE == 14) // Loopback
|
||||
Active = 0;
|
||||
|
||||
else if (PORT->PORTTYPE == 16) // External
|
||||
{
|
||||
if (PORT->PROTOCOL == 10) // 'HF' Port
|
||||
{
|
||||
struct TNCINFO * TNC = TNCInfo[PortNo];
|
||||
struct AGWINFO * AGW;
|
||||
|
||||
if (TNC == NULL)
|
||||
{
|
||||
PORT = PORT->PORTPOINTER;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (TNC->RIG)
|
||||
Freq = TNC->RIG->RigFreq * 1000000;
|
||||
|
||||
switch (TNC->Hardware) // Hardware Type
|
||||
{
|
||||
case H_KAM:
|
||||
case H_AEA:
|
||||
case H_HAL:
|
||||
case H_SERIAL:
|
||||
|
||||
// Serial
|
||||
|
||||
if (TNC->hDevice)
|
||||
Active = 1;
|
||||
|
||||
break;
|
||||
|
||||
case H_SCS:
|
||||
case H_TRK:
|
||||
case H_WINRPR:
|
||||
|
||||
if (TNC->HostMode)
|
||||
Active = 1;
|
||||
|
||||
break;
|
||||
|
||||
|
||||
case H_UZ7HO:
|
||||
|
||||
if (TNCInfo[MasterPort[PortNo]]->CONNECTED)
|
||||
Active = 1;
|
||||
|
||||
// Try to get mode and frequency
|
||||
|
||||
AGW = TNC->AGWInfo;
|
||||
|
||||
if (AGW && AGW->isQTSM)
|
||||
{
|
||||
if (AGW->ModemName[0])
|
||||
{
|
||||
char * ptr1, * ptr2, *Context;
|
||||
|
||||
strcpy(Copy, AGW->ModemName);
|
||||
ptr1 = strtok_s(Copy, " ", & Context);
|
||||
ptr2 = strtok_s(NULL, " ", & Context);
|
||||
|
||||
if (Context)
|
||||
{
|
||||
Modulation = Copy;
|
||||
|
||||
if (strstr(ptr1, "BPSK") || strstr(ptr1, "AFSK"))
|
||||
{
|
||||
Baud = Bitrate = atoi(Context);
|
||||
}
|
||||
else if (strstr(ptr1, "QPSK"))
|
||||
{
|
||||
Modulation = "QPSK";
|
||||
Bitrate = atoi(Context);
|
||||
Baud = Bitrate /2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case H_WINMOR:
|
||||
case H_V4:
|
||||
|
||||
case H_MPSK:
|
||||
case H_FLDIGI:
|
||||
case H_UIARQ:
|
||||
case H_ARDOP:
|
||||
case H_VARA:
|
||||
case H_KISSHF:
|
||||
case H_FREEDATA:
|
||||
|
||||
// TCP
|
||||
|
||||
Mode = Modenames[TNC->Hardware];
|
||||
|
||||
if (TNC->CONNECTED)
|
||||
Active = 1;
|
||||
|
||||
break;
|
||||
|
||||
case H_TELNET:
|
||||
|
||||
Active = 1;
|
||||
Type = "Internet";
|
||||
Mode = "";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// External but not HF - AXIP, BPQETHER VKISS, ??
|
||||
|
||||
struct _EXTPORTDATA * EXTPORT = (struct _EXTPORTDATA *)PORT;
|
||||
Type = "Internet";
|
||||
Active = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (Active)
|
||||
{
|
||||
ptr += sprintf(ptr, "{\"id\": \"%d\",\"linkType\": \"%s\","
|
||||
"\"freq\": \"%lld\",\"mode\": \"%s\",\"modulation\": \"%s\","
|
||||
"\"baud\": \"%d\",\"bitrate\": \"%d\",\"usage\": \"%s\",\"comment\": \"%s\"},\r\n",
|
||||
PortNo, Type,
|
||||
Freq, Mode, Modulation,
|
||||
Baud, Bitrate, "Access", PORT->PORTDESCRIPTION);
|
||||
}
|
||||
|
||||
PORT = PORT->PORTPOINTER;
|
||||
}
|
||||
|
||||
ptr -= 3;
|
||||
ptr += sprintf(ptr, "],\r\n");
|
||||
|
||||
// Neighbours
|
||||
|
||||
ptr += sprintf(ptr, "\"neighbours\": [\r\n");
|
||||
|
||||
while (MaxRoutes--)
|
||||
{
|
||||
if (Routes->NEIGHBOUR_CALL[0] != 0)
|
||||
if (Routes->NEIGHBOUR_LINK && Routes->NEIGHBOUR_LINK->L2STATE >= 5)
|
||||
{
|
||||
ConvFromAX25(Routes->NEIGHBOUR_CALL, Normcall);
|
||||
strlop(Normcall, ' ');
|
||||
|
||||
ptr += sprintf(ptr,
|
||||
"{\"node\": \"%s\", \"port\": \"%d\", \"quality\": \"%d\"},\r\n",
|
||||
Normcall, Routes->NEIGHBOUR_PORT, Routes->NEIGHBOUR_QUAL);
|
||||
}
|
||||
|
||||
Routes++;
|
||||
}
|
||||
|
||||
ptr -= 3;
|
||||
ptr += sprintf(ptr, "]}");
|
||||
|
||||
/*
|
||||
{
|
||||
"nodeAlias": "BPQ",
|
||||
"location": {"locator": "IO92KX"},
|
||||
"software": {"name": "BPQ32","version": "6.0.24.11 Debug Build "},
|
||||
"contact": "G8BPQ",
|
||||
"sysopComment": "Testing",
|
||||
"source": "ReportedByNode"
|
||||
}
|
||||
|
||||
"ports": [
|
||||
{
|
||||
"id": "string",
|
||||
"linkType": "RF",
|
||||
"freq": 0,
|
||||
"mode": "string",
|
||||
"modulation": "string",
|
||||
"baud": 0,
|
||||
"bitrate": 0,
|
||||
"usage": "Access",
|
||||
"comment": "string"
|
||||
}
|
||||
],
|
||||
|
||||
|
||||
|
||||
*/
|
||||
// "contact": "string",
|
||||
// "neighbours": [{"node": "G7TAJ","port": "30"}]
|
||||
|
||||
sock = OpenHTTPSock("packetnodes.spots.radio");
|
||||
|
||||
if (sock == 0)
|
||||
return;
|
||||
|
||||
SendWebRequest(sock, "packetnodes.spots.radio", Request, Params, strlen(Params), Return);
|
||||
closesocket(sock);
|
||||
}
|
||||
|
||||
// ="{\"neighbours\": [{\"node\": \"G7TAJ\",\"port\": \"30\"}]}";
|
||||
|
||||
//'POST' \
|
||||
// 'https://packetnodes.spots.radio/api/NodeData/GM8BPQ' \
|
||||
// -H 'accept: */*' \
|
||||
// -H 'Content-Type: application/json' \
|
||||
// -d '{
|
||||
// "nodeAlias": "BPQ",
|
||||
// "location": {"locator": "IO68VL"},
|
||||
// "software": {"name": "BPQ32","version": "6.0.24.3"},
|
||||
// "contact": "string",
|
||||
// "neighbours": [{"node": "G7TAJ","port": "30"}]
|
||||
//}'
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -472,7 +472,7 @@ ok:
|
|||
|
||||
// Check Filters
|
||||
|
||||
if (CheckRejFilters(FBBHeader->From, FBBHeader->To, FBBHeader->ATBBS, FBBHeader->BID, FBBHeader->MsgType))
|
||||
if (CheckRejFilters(FBBHeader->From, FBBHeader->To, FBBHeader->ATBBS, FBBHeader->BID, FBBHeader->MsgType, FBBHeader->Size))
|
||||
{
|
||||
memset(FBBHeader, 0, sizeof(struct FBBHeaderLine)); // Clear header
|
||||
conn->FBBReplyChars[conn->FBBReplyIndex++] = '-';
|
||||
|
@ -604,7 +604,7 @@ ok:
|
|||
char * To = strtok_s(NULL, seps, &Context);
|
||||
char * Type = strtok_s(NULL, seps, &Context);
|
||||
|
||||
if (From && To && ATBBS && Type && CheckRejFilters(From, To, ATBBS, NULL, *Type))
|
||||
if (From && To && ATBBS && Type && CheckRejFilters(From, To, ATBBS, NULL, *Type, FBBHeader->Size))
|
||||
{
|
||||
memset(FBBHeader, 0, sizeof(struct FBBHeaderLine)); // Clear header
|
||||
conn->FBBReplyChars[conn->FBBReplyIndex++] = '-';
|
||||
|
|
1903
HALDriver.c.bak
1903
HALDriver.c.bak
File diff suppressed because it is too large
Load Diff
10
HTTPcode.c
10
HTTPcode.c
|
@ -99,6 +99,8 @@ extern UCHAR LogDirectory[];
|
|||
extern struct RIGPORTINFO * PORTInfo[34];
|
||||
extern int NumberofPorts;
|
||||
|
||||
extern UCHAR ConfigDirectory[260];
|
||||
|
||||
char * strlop(char * buf, char delim);
|
||||
VOID sendandcheck(SOCKET sock, const char * Buffer, int Len);
|
||||
int CompareNode(const void *a, const void *b);
|
||||
|
@ -1475,13 +1477,13 @@ VOID SaveConfigFile(SOCKET sock , char * MsgPtr, char * Rest, int LOCAL)
|
|||
|
||||
MsgLen = (int)strlen(input + 8);
|
||||
|
||||
if (BPQDirectory[0] == 0)
|
||||
if (ConfigDirectory[0] == 0)
|
||||
{
|
||||
strcpy(inputname, "bpq32.cfg");
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(inputname,BPQDirectory);
|
||||
strcpy(inputname,ConfigDirectory);
|
||||
strcat(inputname,"/");
|
||||
strcat(inputname, "bpq32.cfg");
|
||||
}
|
||||
|
@ -3024,13 +3026,13 @@ doHeader:
|
|||
if (COOKIE ==FALSE)
|
||||
Key = DummyKey;
|
||||
|
||||
if (BPQDirectory[0] == 0)
|
||||
if (ConfigDirectory[0] == 0)
|
||||
{
|
||||
strcpy(inputname, "bpq32.cfg");
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(inputname,BPQDirectory);
|
||||
strcpy(inputname,ConfigDirectory);
|
||||
strcat(inputname,"/");
|
||||
strcat(inputname, "bpq32.cfg");
|
||||
}
|
||||
|
|
4849
HTTPcode.c.bak
4849
HTTPcode.c.bak
File diff suppressed because it is too large
Load Diff
43
HanksRT.c
43
HanksRT.c
|
@ -75,6 +75,7 @@ char ChatWelcomeMsg[1000];
|
|||
char Position[81] = "";
|
||||
char PopupText[260] = "";
|
||||
int PopupMode = 0;
|
||||
int chatPaclen = 236;
|
||||
|
||||
char RtKnown[MAX_PATH] = "RTKnown.txt";
|
||||
char RtUsr[MAX_PATH] = "STUsers.txt";
|
||||
|
@ -97,6 +98,7 @@ int ChatTmr = 0;
|
|||
|
||||
BOOL NeedStatus = FALSE;
|
||||
|
||||
|
||||
char Verstring[80];
|
||||
|
||||
static void node_dec(CHATNODE *node);
|
||||
|
@ -597,7 +599,9 @@ VOID ProcessChatLine(ChatCIRCUIT * conn, struct UserInfo * user, char* OrigBuffe
|
|||
Buffer = BufferB;
|
||||
|
||||
#else
|
||||
int left = 65536;
|
||||
size_t left = 65536;
|
||||
size_t clen = len;
|
||||
|
||||
UCHAR * BufferBP = BufferB;
|
||||
struct user_t * icu = conn->u.user;
|
||||
|
||||
|
@ -605,22 +609,22 @@ VOID ProcessChatLine(ChatCIRCUIT * conn, struct UserInfo * user, char* OrigBuffe
|
|||
{
|
||||
if (icu->iconv_toUTF8 == NULL)
|
||||
{
|
||||
icu->iconv_toUTF8 = iconv_open("UTF-8", icu->Codepage);
|
||||
icu->iconv_toUTF8 = iconv_open("UTF-8//IGNORE", icu->Codepage);
|
||||
|
||||
if (icu->iconv_toUTF8 == (iconv_t)-1)
|
||||
icu->iconv_toUTF8 = iconv_open("UTF-8", "CP1252");
|
||||
icu->iconv_toUTF8 = iconv_open("UTF-8//IGNORE", "CP1252");
|
||||
}
|
||||
|
||||
iconv(icu->iconv_toUTF8, NULL, NULL, NULL, NULL); // Reset State Machine
|
||||
iconv(icu->iconv_toUTF8, &Buffer, &len, (char ** __restrict__)&BufferBP, &left);
|
||||
iconv(icu->iconv_toUTF8, &Buffer, &clen, (char ** __restrict__)&BufferBP, &left);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (link_toUTF8 == NULL)
|
||||
link_toUTF8 = iconv_open("UTF-8", "CP1252");
|
||||
link_toUTF8 = iconv_open("UTF-8//IGNORE", "CP1252");
|
||||
|
||||
iconv(link_toUTF8, NULL, NULL, NULL, NULL); // Reset State Machine
|
||||
iconv(link_toUTF8, &Buffer, &len, (char ** __restrict__)&BufferBP, &left);
|
||||
iconv(link_toUTF8, &Buffer, &clen, (char ** __restrict__)&BufferBP, &left);
|
||||
}
|
||||
len = 65536 - left;
|
||||
Buffer = BufferB;
|
||||
|
@ -1121,12 +1125,12 @@ void rduser(USER *user)
|
|||
// Open an iconv decriptor for each conversion
|
||||
|
||||
if (user->Codepage[0])
|
||||
user->iconv_toUTF8 = iconv_open("UTF-8", user->Codepage);
|
||||
user->iconv_toUTF8 = iconv_open("UTF-8//IGNORE", user->Codepage);
|
||||
else
|
||||
user->iconv_toUTF8 = (iconv_t)-1;
|
||||
|
||||
if (user->iconv_toUTF8 == (iconv_t)-1)
|
||||
user->iconv_toUTF8 = iconv_open("UTF-8", "CP1252");
|
||||
user->iconv_toUTF8 = iconv_open("UTF-8//IGNORE", "CP1252");
|
||||
|
||||
|
||||
if (user->Codepage[0])
|
||||
|
@ -1135,7 +1139,7 @@ void rduser(USER *user)
|
|||
user->iconv_fromUTF8 = (iconv_t)-1;
|
||||
|
||||
if (user->iconv_fromUTF8 == (iconv_t)-1)
|
||||
user->iconv_fromUTF8 = iconv_open("CP1252", "UTF-8");
|
||||
user->iconv_fromUTF8 = iconv_open("CP1252//IGNORE", "UTF-8");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -1936,7 +1940,7 @@ void put_text(ChatCIRCUIT * circuit, USER * user, UCHAR * buf)
|
|||
{
|
||||
UCHAR BufferB[4096];
|
||||
|
||||
// Text is UTF-8 internally. If use doen't want UTF-8. convert to Node's locale
|
||||
// Text is UTF-8 internally. If user doen't want UTF-8. convert to Node's locale
|
||||
|
||||
if (circuit->u.user->rtflags & u_noUTF8)
|
||||
{
|
||||
|
@ -1957,9 +1961,9 @@ void put_text(ChatCIRCUIT * circuit, USER * user, UCHAR * buf)
|
|||
BufferB[blen + 2] = 0;
|
||||
#else
|
||||
|
||||
int left = 4096;
|
||||
size_t left = 4096;
|
||||
UCHAR * BufferBP = BufferB;
|
||||
int len = strlen(buf) + 1;
|
||||
size_t len = strlen(buf) + 1;
|
||||
struct user_t * icu = circuit->u.user;
|
||||
|
||||
if (icu->iconv_fromUTF8 == NULL)
|
||||
|
@ -1967,7 +1971,7 @@ void put_text(ChatCIRCUIT * circuit, USER * user, UCHAR * buf)
|
|||
icu->iconv_fromUTF8 = iconv_open(icu->Codepage, "UTF-8");
|
||||
|
||||
if (icu->iconv_fromUTF8 == (iconv_t)-1)
|
||||
icu->iconv_fromUTF8 = iconv_open("CP1252", "UTF-8");
|
||||
icu->iconv_fromUTF8 = iconv_open("CP1252//IGNORE", "UTF-8");
|
||||
}
|
||||
|
||||
iconv(icu->iconv_fromUTF8, NULL, NULL, NULL, NULL); // Reset State Machine
|
||||
|
@ -3863,7 +3867,7 @@ int ChatConnected(int Stream)
|
|||
|
||||
if (conn->rtcflags == p_linkini)
|
||||
{
|
||||
conn->paclen = 236;
|
||||
conn->paclen = chatPaclen;
|
||||
|
||||
// Run first line of connect script
|
||||
|
||||
|
@ -3883,6 +3887,9 @@ int ChatConnected(int Stream)
|
|||
if (paclen == 0)
|
||||
paclen = 256;
|
||||
|
||||
if (paclen > chatPaclen)
|
||||
paclen = chatPaclen;
|
||||
|
||||
conn->paclen = paclen;
|
||||
|
||||
strlop(callsign, ' '); // Remove trailing spaces
|
||||
|
@ -4163,12 +4170,19 @@ BOOL GetChatConfig(char * ConfigName)
|
|||
|
||||
ChatApplNum = GetIntValue(group, "ApplNum");
|
||||
MaxChatStreams = GetIntValue(group, "MaxStreams");
|
||||
chatPaclen = GetIntValue(group, "chatPaclen");
|
||||
GetStringValue(group, "OtherChatNodes", OtherNodesList);
|
||||
GetStringValue(group, "ChatWelcomeMsg", ChatWelcomeMsg);
|
||||
GetStringValue(group, "MapPosition", Position);
|
||||
GetStringValue(group, "MapPopup", PopupText);
|
||||
PopupMode = GetIntValue(group, "PopupMode");
|
||||
|
||||
if (chatPaclen == 0)
|
||||
chatPaclen = 236;
|
||||
|
||||
if (chatPaclen < 60)
|
||||
chatPaclen = 60;
|
||||
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
@ -4187,6 +4201,7 @@ VOID SaveChatConfigFile(char * ConfigName)
|
|||
|
||||
SaveIntValue(group, "ApplNum", ChatApplNum);
|
||||
SaveIntValue(group, "MaxStreams", MaxChatStreams);
|
||||
SaveIntValue(group, "chatPaclen", chatPaclen);
|
||||
SaveStringValue(group, "OtherChatNodes", OtherNodesList);
|
||||
SaveStringValue(group, "ChatWelcomeMsg", ChatWelcomeMsg);
|
||||
|
||||
|
|
14
L2Code.c
14
L2Code.c
|
@ -965,6 +965,11 @@ VOID ProcessXIDCommand(struct _LINKTABLE * LINK, struct PORTCONTROL * PORT, MESS
|
|||
|
||||
L2SWAPADDRESSES(Buffer); // SWAP ADDRESSES AND SET RESP BITS
|
||||
|
||||
// We need to save APPLMASK and ALIASPTR so following SABM connects to application
|
||||
|
||||
LINK->APPLMASK = APPLMASK;
|
||||
LINK->ALIASPTR = ALIASPTR;
|
||||
|
||||
PUT_ON_PORT_Q(PORT, Buffer);
|
||||
return;
|
||||
}
|
||||
|
@ -1089,6 +1094,9 @@ VOID L2LINKACTIVE(struct _LINKTABLE * LINK, struct PORTCONTROL * PORT, MESSAGE *
|
|||
|
||||
if (LINK->L2STATE == 1) // Sent XID?
|
||||
{
|
||||
APPLMASK = LINK->APPLMASK;
|
||||
ALIASPTR = LINK->ALIASPTR;
|
||||
|
||||
L2SABM(LINK, PORT, Buffer, ADJBUFFER, MSGFLAG); // Process the SABM
|
||||
return;
|
||||
}
|
||||
|
@ -1351,7 +1359,7 @@ VOID L2SABM(struct _LINKTABLE * LINK, struct PORTCONTROL * PORT, MESSAGE * Buffe
|
|||
{
|
||||
Msg->PID = 0xf0;
|
||||
|
||||
memcpy(Msg->L2DATA, APPL->APPLCMD, 12);
|
||||
memcpy(Msg->L2DATA, ALIASPTR, 12);
|
||||
Msg->L2DATA[12] = 13;
|
||||
|
||||
Msg->LENGTH = MSGHDDRLEN + 12 + 2; // 2 for PID and CR
|
||||
|
@ -2412,6 +2420,10 @@ CheckPF:
|
|||
|
||||
LINK->LAST_F_TIME = REALTIMETICKS;
|
||||
}
|
||||
else
|
||||
if (LINK->L2ACKREQ == 0) // Resptime is zero so send RR now
|
||||
SEND_RR_RESP(LINK, 0);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
132
LinBPQ.c
132
LinBPQ.c
|
@ -28,6 +28,7 @@ along with LinBPQ/BPQ32. If not, see http://www.gnu.org/licenses
|
|||
//#include "C:\Program Files (x86)\GnuWin32\include\iconv.h"
|
||||
#else
|
||||
#include <iconv.h>
|
||||
#include <errno.h>
|
||||
#ifndef MACBPQ
|
||||
#ifndef FREEBSD
|
||||
#include <sys/prctl.h>
|
||||
|
@ -75,6 +76,8 @@ void SaveAIS();
|
|||
void initAIS();
|
||||
void DRATSPoll();
|
||||
|
||||
extern uint64_t timeLoadedMS;
|
||||
|
||||
BOOL IncludesMail = FALSE;
|
||||
BOOL IncludesChat = FALSE;
|
||||
|
||||
|
@ -174,8 +177,15 @@ int _MYTIMEZONE = 0;
|
|||
/* #define F_PWD 0x1000 */
|
||||
|
||||
|
||||
UCHAR BPQDirectory[260];
|
||||
UCHAR LogDirectory[260];
|
||||
extern UCHAR BPQDirectory[260];
|
||||
extern UCHAR LogDirectory[260];
|
||||
extern UCHAR ConfigDirectory[260];
|
||||
|
||||
// overrides from params
|
||||
UCHAR LogDir[260] = "";
|
||||
UCHAR ConfigDir[260] = "";
|
||||
UCHAR DataDir[260] = "";
|
||||
|
||||
|
||||
BOOL GetConfig(char * ConfigName);
|
||||
VOID DecryptPass(char * Encrypt, unsigned char * Pass, unsigned int len);
|
||||
|
@ -705,6 +715,24 @@ void ConTermPoll()
|
|||
|
||||
}
|
||||
|
||||
#include "getopt.h"
|
||||
|
||||
static struct option long_options[] =
|
||||
{
|
||||
{"logdir", required_argument, 0 , 'l'},
|
||||
{"configdir", required_argument, 0 , 'c'},
|
||||
{"datadir", required_argument, 0 , 'd'},
|
||||
{"help", no_argument, 0 , 'h'},
|
||||
{ NULL , no_argument , NULL , no_argument }
|
||||
};
|
||||
|
||||
char HelpScreen[] =
|
||||
"Usage:\n"
|
||||
"Optional Paramters\n"
|
||||
"-l path or --logdir path Path for log files\n"
|
||||
"-c path or --configdir path Path to Config file bpq32.cfg\n"
|
||||
"-d path or --datadir path Path to Data Files\n"
|
||||
"-v Show version and exit\n";
|
||||
|
||||
int Redirected = 0;
|
||||
|
||||
|
@ -715,7 +743,6 @@ int main(int argc, char * argv[])
|
|||
ConnectionInfo * conn;
|
||||
struct stat STAT;
|
||||
PEXTPORTDATA PORTVEC;
|
||||
UCHAR LogDir[260];
|
||||
|
||||
#ifdef WIN32
|
||||
|
||||
|
@ -755,13 +782,64 @@ int main(int argc, char * argv[])
|
|||
if (!isatty(STDOUT_FILENO) || !isatty(STDIN_FILENO))
|
||||
Redirected = 1;
|
||||
|
||||
timeLoadedMS = GetTickCount();
|
||||
|
||||
#endif
|
||||
|
||||
printf("G8BPQ AX25 Packet Switch System Version %s %s\n", TextVerstring, Datestring);
|
||||
printf("%s\n", VerCopyright);
|
||||
|
||||
if (argc > 1 && _stricmp(argv[1], "-v") == 0)
|
||||
|
||||
// look for optarg format parameters
|
||||
|
||||
{
|
||||
int val;
|
||||
UCHAR * ptr1;
|
||||
UCHAR * ptr2;
|
||||
int c;
|
||||
|
||||
while (1)
|
||||
{
|
||||
int option_index = 0;
|
||||
|
||||
c = getopt_long(argc, argv, "l:c:d:hv", long_options, &option_index);
|
||||
|
||||
// Check for end of operation or error
|
||||
|
||||
if (c == -1)
|
||||
break;
|
||||
|
||||
// Handle options
|
||||
switch (c)
|
||||
{
|
||||
case 'h':
|
||||
|
||||
printf(HelpScreen);
|
||||
exit (0);
|
||||
|
||||
case 'l':
|
||||
strcpy(LogDir, optarg);
|
||||
printf("cc %s\n", LogDir);
|
||||
break;
|
||||
|
||||
case 'c':
|
||||
strcpy(ConfigDir, optarg);
|
||||
break;
|
||||
|
||||
case 'd':
|
||||
strcpy(DataDir, optarg);
|
||||
break;
|
||||
|
||||
|
||||
case '?':
|
||||
/* getopt_long already printed an error message. */
|
||||
break;
|
||||
|
||||
case 'v':
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sprintf(RlineVer, "LinBPQ%d.%d.%d", Ver[0], Ver[1], Ver[2]);
|
||||
|
||||
|
@ -777,22 +855,41 @@ int main(int argc, char * argv[])
|
|||
|
||||
#ifdef WIN32
|
||||
GetCurrentDirectory(256, BPQDirectory);
|
||||
GetCurrentDirectory(256, LogDirectory);
|
||||
#else
|
||||
getcwd(BPQDirectory, 256);
|
||||
getcwd(LogDirectory, 256);
|
||||
#endif
|
||||
Consoleprintf("Current Directory is %s\n", BPQDirectory);
|
||||
|
||||
for (i = 1; i < argc; i++)
|
||||
strcpy(ConfigDirectory, BPQDirectory);
|
||||
strcpy(LogDirectory, BPQDirectory);
|
||||
|
||||
Consoleprintf("Current Directory is %s", BPQDirectory);
|
||||
|
||||
if (LogDir[0])
|
||||
{
|
||||
strcpy(LogDirectory, LogDir);
|
||||
}
|
||||
if (DataDir[0])
|
||||
{
|
||||
strcpy(BPQDirectory, DataDir);
|
||||
Consoleprintf("Working Directory is %s", BPQDirectory);
|
||||
}
|
||||
if (ConfigDir[0])
|
||||
{
|
||||
strcpy(ConfigDirectory, ConfigDir);
|
||||
Consoleprintf("Config Directory is %s", ConfigDirectory);
|
||||
}
|
||||
|
||||
for (i = optind; i < argc; i++)
|
||||
{
|
||||
if (_memicmp(argv[i], "logdir=", 7) == 0)
|
||||
{
|
||||
strcpy(LogDirectory, &argv[i][7]);
|
||||
Consoleprintf("Log Directory is %s\n", LogDirectory);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Consoleprintf("Log Directory is %s", LogDirectory);
|
||||
|
||||
// Make sure logs directory exists
|
||||
|
||||
|
@ -801,7 +898,13 @@ int main(int argc, char * argv[])
|
|||
#ifdef WIN32
|
||||
CreateDirectory(LogDir, NULL);
|
||||
#else
|
||||
mkdir(LogDir, S_IRWXU | S_IRWXG | S_IRWXO);
|
||||
printf("Making Directory %s\n", LogDir);
|
||||
i = mkdir(LogDir, S_IRWXU | S_IRWXG | S_IRWXO);
|
||||
if (i == -1 && errno != EEXIST)
|
||||
{
|
||||
perror("Couldn't create log directory\n");
|
||||
return 0;
|
||||
}
|
||||
chmod(LogDir, S_IRWXU | S_IRWXG | S_IRWXO);
|
||||
#endif
|
||||
|
||||
|
@ -885,7 +988,7 @@ int main(int argc, char * argv[])
|
|||
|
||||
#endif
|
||||
|
||||
for (i = 1; i < argc; i++)
|
||||
for (i = optind; i < argc; i++)
|
||||
{
|
||||
if (_stricmp(argv[i], "chat") == 0)
|
||||
IncludesChat = TRUE;
|
||||
|
@ -936,7 +1039,7 @@ int main(int argc, char * argv[])
|
|||
|
||||
// Start Mail if requested by command line or config
|
||||
|
||||
for (i = 1; i < argc; i++)
|
||||
for (i = optind; i < argc; i++)
|
||||
{
|
||||
if (_stricmp(argv[i], "mail") == 0)
|
||||
IncludesMail = TRUE;
|
||||
|
@ -1166,7 +1269,7 @@ int main(int argc, char * argv[])
|
|||
DoHouseKeeping(FALSE);
|
||||
}
|
||||
}
|
||||
for (i = 1; i < argc; i++)
|
||||
for (i = optind; i < argc; i++)
|
||||
{
|
||||
if (_stricmp(argv[i], "tidymail") == 0)
|
||||
DeleteRedundantMessages();
|
||||
|
@ -1799,6 +1902,8 @@ struct TNCINFO * TNC;
|
|||
#define CLOCK_REALTIME 0
|
||||
#define CLOCK_MONOTONIC 0
|
||||
|
||||
|
||||
|
||||
int clock_gettime(int clk_id, struct timespec *t){
|
||||
mach_timebase_info_data_t timebase;
|
||||
mach_timebase_info(&timebase);
|
||||
|
@ -1813,7 +1918,8 @@ int clock_gettime(int clk_id, struct timespec *t){
|
|||
#endif
|
||||
#endif
|
||||
|
||||
int GetTickCount()
|
||||
|
||||
uint64_t GetTickCount()
|
||||
{
|
||||
struct timespec ts;
|
||||
clock_gettime(CLOCK_REALTIME, &ts);
|
||||
|
|
Binary file not shown.
|
@ -336,6 +336,10 @@
|
|||
RelativePath=".\FreeDATA.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\getopt.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\CommonSource\HALDriver.c"
|
||||
>
|
||||
|
|
|
@ -0,0 +1,65 @@
|
|||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioUserFile
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
ShowAllFiles="false"
|
||||
>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<DebugSettings
|
||||
Command="$(TargetPath)"
|
||||
WorkingDirectory=""
|
||||
CommandArguments=""
|
||||
Attach="false"
|
||||
DebuggerType="3"
|
||||
Remote="1"
|
||||
RemoteMachine="DESKTOP-MHE5LO8"
|
||||
RemoteCommand=""
|
||||
HttpUrl=""
|
||||
PDBPath=""
|
||||
SQLDebugging=""
|
||||
Environment=""
|
||||
EnvironmentMerge="true"
|
||||
DebuggerFlavor=""
|
||||
MPIRunCommand=""
|
||||
MPIRunArguments=""
|
||||
MPIRunWorkingDirectory=""
|
||||
ApplicationCommand=""
|
||||
ApplicationArguments=""
|
||||
ShimCommand=""
|
||||
MPIAcceptMode=""
|
||||
MPIAcceptFilter=""
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<DebugSettings
|
||||
Command="$(TargetPath)"
|
||||
WorkingDirectory=""
|
||||
CommandArguments=""
|
||||
Attach="false"
|
||||
DebuggerType="3"
|
||||
Remote="1"
|
||||
RemoteMachine="DESKTOP-MHE5LO8"
|
||||
RemoteCommand=""
|
||||
HttpUrl=""
|
||||
PDBPath=""
|
||||
SQLDebugging=""
|
||||
Environment=""
|
||||
EnvironmentMerge="true"
|
||||
DebuggerFlavor=""
|
||||
MPIRunCommand=""
|
||||
MPIRunArguments=""
|
||||
MPIRunWorkingDirectory=""
|
||||
ApplicationCommand=""
|
||||
ApplicationArguments=""
|
||||
ShimCommand=""
|
||||
MPIAcceptMode=""
|
||||
MPIAcceptFilter=""
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
</VisualStudioUserFile>
|
|
@ -11,7 +11,7 @@
|
|||
<DebugSettings
|
||||
Command="$(TargetPath)"
|
||||
WorkingDirectory="C:\linbpq"
|
||||
CommandArguments="mail"
|
||||
CommandArguments="-h"
|
||||
Attach="false"
|
||||
DebuggerType="3"
|
||||
Remote="1"
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
<ProjectGuid>{3766AA10-C777-4ED8-A83D-F1452DE9B666}</ProjectGuid>
|
||||
<RootNamespace>MailNode</RootNamespace>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
|
@ -119,7 +120,7 @@
|
|||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>kernel32.lib;WS2_32.Lib;C:\OneDrive\Dev\Source\bpq32\libconfig\x64\Release\libconfig.lib;DbgHelp.lib;setupapi.lib;C:\OneDrive\Dev\Source\miniupnpc-2.2.3\msvc\x64\Debug\miniupnpc.lib;C:\Users\johnw\Downloads\zlib-1.2.11-binaries-x64-release\zlib-1.2.11\binaries\x64\Release\zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>kernel32.lib;WS2_32.Lib;..\lib\libconfigd.lib;DbgHelp.lib;setupapi.lib;miniupnpc.lib;zlibstat.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>c:\LINBPQ\$(ProjectName).exe</OutputFile>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<GenerateMapFile>true</GenerateMapFile>
|
||||
|
@ -127,7 +128,6 @@
|
|||
<SubSystem>Console</SubSystem>
|
||||
<StackReserveSize>4000000</StackReserveSize>
|
||||
<StackCommitSize>0</StackCommitSize>
|
||||
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LocalDebuggerCommand>C:\Dev\Msdev2005\projects\bpq32\BPQMail\x64\Debug\LinBPQ.exe</LocalDebuggerCommand>
|
||||
<LocalDebuggerWorkingDirectory>c:\linbpq</LocalDebuggerWorkingDirectory>
|
||||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||
</PropertyGroup>
|
||||
</Project>
|
File diff suppressed because it is too large
Load Diff
|
@ -2207,6 +2207,7 @@ int TidyString(char * Address)
|
|||
size_t len;
|
||||
|
||||
_strupr(Address);
|
||||
Debugprintf(Address);
|
||||
|
||||
ptr1 = strchr(Address, '<');
|
||||
|
||||
|
@ -2260,6 +2261,10 @@ int TidyString(char * Address)
|
|||
ptr1=ptr2;
|
||||
}
|
||||
|
||||
if (ptr1 == 0)
|
||||
return 0;
|
||||
|
||||
|
||||
if (*ptr1 == '<') ptr1++;
|
||||
|
||||
ptr2 = strlop(ptr1, '>');
|
||||
|
|
|
@ -0,0 +1,120 @@
|
|||
[General]
|
||||
HostParams0=|0||||
|
||||
HostParams1=|0||||
|
||||
HostParams2=|0||||
|
||||
HostParams3=|0||||
|
||||
HostParams4=|0||||
|
||||
HostParams5=|0||||
|
||||
HostParams6=|0||||
|
||||
HostParams7=|0||||
|
||||
HostParams8=|0||||
|
||||
HostParams9=|0||||
|
||||
HostParams10=|0||||
|
||||
HostParams11=|0||||
|
||||
HostParams12=|0||||
|
||||
HostParams13=|0||||
|
||||
HostParams14=|0||||
|
||||
HostParams15=|0||||
|
||||
Split=50
|
||||
ChatMode=1
|
||||
AutoTeletext=0
|
||||
Bells=1
|
||||
StripLF=1
|
||||
AlertBeep=1
|
||||
ConnectBeep=1
|
||||
AlertInterval=300
|
||||
CurrentHost=0 0 0 0 0 0 0 0 0 0
|
||||
YAPPPath=
|
||||
MaxRXSize=100000
|
||||
listenPort=8015
|
||||
listenEnable=0
|
||||
listenCText=
|
||||
convUTF8=0
|
||||
PTT=None
|
||||
PTTBAUD=19200
|
||||
PTTMode=19200
|
||||
CATHex=1
|
||||
PTTOffString=
|
||||
PTTOnString=
|
||||
pttGPIOPin=17
|
||||
pttGPIOPinR=17
|
||||
CM108Addr=0xD8C:0x08
|
||||
HamLibPort=4532
|
||||
HamLibHost=127.0.0.1
|
||||
FLRigPort=12345
|
||||
FLRigHost=127.0.0.1
|
||||
AGWEnable=0
|
||||
AGWMonEnable=0
|
||||
AGWTermCall=
|
||||
AGWBeaconDest=
|
||||
AGWBeaconPath=
|
||||
AGWBeaconInterval=0
|
||||
AGWBeaconPorts=
|
||||
AGWBeaconText=
|
||||
AGWHost=127.0.0.1
|
||||
AGWPort=8000
|
||||
AGWPaclen=80
|
||||
AGWToCalls=
|
||||
KISSEnable=0
|
||||
MYCALL=
|
||||
KISSHost=127.0.0.1
|
||||
KISSMode=0
|
||||
KISSPort=8100
|
||||
KISSSerialPort=None
|
||||
KISSBAUD=19200
|
||||
VARAEnable=0
|
||||
VARATermCall=
|
||||
VARAHost=127.0.0.1
|
||||
VARAPort=8300
|
||||
VARAInit=
|
||||
VARAPath=C:\\VARA\\VARA.exe
|
||||
VARAHostHF=127.0.0.1
|
||||
VARAPortHF=8300
|
||||
VARAPathHF=C:\\VARA\\VARA.exe
|
||||
VARAHostFM=127.0.0.1
|
||||
VARAPortFM=8300
|
||||
VARAPathFM=C:\\VARA\\VARAFM.exe
|
||||
VARAHostSAT=127.0.0.1
|
||||
VARAPortSAT=8300
|
||||
VARAPathSAT=C:\\VARA\\VARASAT.exe
|
||||
VARA500=0
|
||||
VARA2300=1
|
||||
VARA2750=0
|
||||
VARAHF=1
|
||||
VARAFM=0
|
||||
VARASAT=0
|
||||
TabType=1 1 1 1 1 1 1 2 2 0
|
||||
AutoConnect=0 0 0 0 0 0 0 0 0 0
|
||||
monBackground=@Variant(\0\0\0\x43\x1\xff\xff\xff\xff\xff\xff\xff\xff\0\0)
|
||||
monRxText=@Variant(\0\0\0\x43\x1\xff\xff\0\0\0\0\xff\xff\0\0)
|
||||
monTxText=@Variant(\0\0\0\x43\x1\xff\xff\xff\xff\0\0\0\0\0\0)
|
||||
monOtherText=@Variant(\0\0\0\x43\x1\xff\xff\0\0\0\0\0\0\0\0)
|
||||
termBackground=@Variant(\0\0\0\x43\x1\xff\xff\xff\xff\xff\xff\xff\xff\0\0)
|
||||
outputText=@Variant(\0\0\0\x43\x1\xff\xff\0\0\0\0\xff\xff\0\0)
|
||||
EchoText=@Variant(\0\0\0\x43\x1\xff\xff\0\0\0\0\0\0\0\0)
|
||||
WarningText=@Variant(\0\0\0\x43\x1\xff\xff\xff\xff\0\0\0\0\0\0)
|
||||
inputBackground=@Variant(\0\0\0\x43\x1\xff\xff\xff\xff\xff\xff\xff\xff\0\0)
|
||||
inputText=@Variant(\0\0\0\x43\x1\xff\xff\0\0\0\0\0\0\0\0)
|
||||
useBeep=false
|
||||
geometry=@ByteArray(\x1\xd9\xd0\xcb\0\x3\0\0\0\0\x2\x39\0\0\0\xab\0\0\x5\x45\0\0\x3\x64\0\0\x2\x39\0\0\0\xab\0\0\x5\x45\0\0\x3\x64\0\0\0\0\0\0\0\0\a\x80\0\0\x2\x39\0\0\0\xab\0\0\x5\x45\0\0\x3\x64)
|
||||
windowState=@ByteArray(\0\0\0\xff\0\0\0\0\xfd\0\0\0\0\0\0\x3\r\0\0\x2\xa4\0\0\0\x4\0\0\0\x4\0\0\0\b\0\0\0\b\xfc\0\0\0\x1\0\0\0\x3\0\0\0\x1\0\0\0\x16\0m\0\x61\0i\0n\0T\0o\0o\0l\0\x62\0\x61\0r\0\0\0\0\0\xff\xff\xff\xff\0\0\0\0\0\0\0\0)
|
||||
ConnectWAV=C:/OneDrive/Dev/Source/bpq32/CommonSource/Ring.wav
|
||||
|
||||
[AX25_A]
|
||||
Retries=10
|
||||
Maxframe=4
|
||||
Paclen=128
|
||||
FrackTime=8
|
||||
IdleTime=180
|
||||
SlotTime=100
|
||||
Persist=128
|
||||
RespTime=1500
|
||||
TXFrmMode=1
|
||||
FrameCollector=6
|
||||
ExcludeCallsigns=
|
||||
ExcludeAPRSFrmType=
|
||||
KISSOptimization=0
|
||||
DynamicFrack=0
|
||||
BitRecovery=0
|
||||
IPOLL=80
|
||||
MyDigiCall=
|
778
RigControl.c
778
RigControl.c
|
@ -125,6 +125,16 @@ VOID SetupPortRIGPointers();
|
|||
VOID PTTCATThread(struct RIGINFO *RIG);
|
||||
VOID ConnecttoHAMLIB(struct RIGPORTINFO * PORT);
|
||||
|
||||
// ----- G7TAJ ----
|
||||
VOID ConnecttoSDRANGEL(struct RIGPORTINFO * PORT);
|
||||
VOID SDRANGELPoll(struct RIGPORTINFO * PORT);
|
||||
void ProcessSDRANGELFrame(struct RIGPORTINFO * PORT);
|
||||
VOID SDRANGELSendCommand(struct RIGPORTINFO * PORT, char * Command, char * Value);
|
||||
void SDRANGELProcessMessage(struct RIGPORTINFO * PORT);
|
||||
|
||||
// ----- G7TAJ ----
|
||||
|
||||
|
||||
int SendPTCRadioCommand(struct TNCINFO * TNC, char * Block, int Length);
|
||||
int GetPTCRadioCommand(struct TNCINFO * TNC, char * Block);
|
||||
int BuildRigCtlPage(char * _REPLYBUFFER);
|
||||
|
@ -184,6 +194,10 @@ int HAMLIBMasterRunning = 0;
|
|||
int HAMLIBSlaveRunning = 0;
|
||||
int FLRIGRunning = 0;
|
||||
|
||||
// ---- G7TAJ ----
|
||||
int SDRANGELRunning = 0;
|
||||
// ---- G7TAJ ----
|
||||
|
||||
char * RigWebPage = 0;
|
||||
int RigWebPageLen = 0;
|
||||
|
||||
|
@ -796,6 +810,26 @@ static char Req[] = "<?xml version=\"1.0\"?>\r\n"
|
|||
"</methodCall>\r\n";
|
||||
|
||||
|
||||
// ---- G7TAJ ----
|
||||
static char SDRANGEL_MsgHddr[] = "PATCH HTTP/1.1\r\n"
|
||||
"User-Agent: BPQ32\r\n"
|
||||
"Host: %s\r\n"
|
||||
"accept: application/json"
|
||||
"Content-Type: application/json"
|
||||
"Content-length: %d\r\n"
|
||||
"\r\n%s";
|
||||
|
||||
static char SDRANGEL_FREQ_DATA[] = "{"
|
||||
"\"deviceHwType\": \"%s\", "
|
||||
"\"direction\": 0,"
|
||||
"\"rtlSdrSettings\": {"
|
||||
" \"centerFrequency\": \"%s\""
|
||||
"}}";
|
||||
|
||||
//freq = 10489630000
|
||||
|
||||
// ---- G7TAJ ----
|
||||
|
||||
|
||||
|
||||
int Rig_CommandEx(struct RIGPORTINFO * PORT, struct RIGINFO * RIG, TRANSPORTENTRY * Session, char * Command)
|
||||
|
@ -2084,7 +2118,43 @@ int Rig_CommandEx(struct RIGPORTINFO * PORT, struct RIGINFO * RIG, TRANSPORTENTR
|
|||
sprintf(Command, "Ok\r");
|
||||
return FALSE;
|
||||
}
|
||||
// --- G7TAJ ----
|
||||
case SDRANGEL:
|
||||
{
|
||||
char cmd[80];
|
||||
int len = sprintf(cmd, "%.0f", Freq);
|
||||
|
||||
strcpy(PORT->ScanEntry.Cmd2Msg, Mode);
|
||||
strcpy(PORT->ScanEntry.Cmd3Msg, FilterString);
|
||||
|
||||
if (Freq > 0.0)
|
||||
{
|
||||
SDRANGELSendCommand(PORT, "FREQSET", cmd);
|
||||
sprintf(Command, "Ok\r");
|
||||
return FALSE;
|
||||
}
|
||||
//TODO
|
||||
/* else if (PORT->ScanEntry.Cmd2Msg[0] && Mode[0] != '*')
|
||||
{
|
||||
sprintf(cmd, "<i4>%s</i4>", PORT->ScanEntry.Cmd2Msg);
|
||||
FLRIGSendCommand(PORT, "rig.set_mode", cmd);
|
||||
}
|
||||
|
||||
else if (PORT->ScanEntry.Cmd3Msg[0] && strcmp(PORT->ScanEntry.Cmd3Msg, "0") != 0)
|
||||
{
|
||||
sprintf(cmd, "<i4>%s</i4>", PORT->ScanEntry.Cmd3Msg);
|
||||
FLRIGSendCommand(PORT, "rig.set_bandwidth", cmd);
|
||||
}
|
||||
*/
|
||||
else
|
||||
{
|
||||
sprintf(Command, "Sorry - Nothing to do\r");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
PORT->AutoPoll = 0;
|
||||
}
|
||||
// --- G7TAJ ----
|
||||
|
||||
|
||||
|
||||
|
@ -2271,6 +2341,14 @@ DllExport BOOL APIENTRY Rig_Init()
|
|||
}
|
||||
else if (PORT->PortType == RTLUDP)
|
||||
ConnecttoRTLUDP(PORT);
|
||||
//---- G7TAJ ----
|
||||
else if (PORT->PortType == SDRANGEL)
|
||||
{
|
||||
SDRANGELRunning = 1;
|
||||
ConnecttoSDRANGEL(PORT);
|
||||
|
||||
}
|
||||
//---- G7TAJ ----
|
||||
else if (PORT->HIDDevice) // This is RAWHID, Not CM108
|
||||
OpenHIDPort(PORT, PORT->IOBASE, PORT->SPEED);
|
||||
else if (PORT->PTC == 0 && _stricmp(PORT->IOBASE, "CM108") != 0)
|
||||
|
@ -2422,6 +2500,9 @@ DllExport BOOL APIENTRY Rig_Close()
|
|||
HAMLIBMasterRunning = 0; // Close HAMLIB thread(s)
|
||||
HAMLIBSlaveRunning = 0; // Close HAMLIB thread(s)
|
||||
FLRIGRunning = 0; // Close FLRIG thread(s)
|
||||
// ---- G7TAJ ----
|
||||
SDRANGELRunning = 0; // Close SDRANGEL thread(s)
|
||||
// ---- G7TAJ ----
|
||||
|
||||
for (p = 0; p < NumberofPorts; p++)
|
||||
{
|
||||
|
@ -2544,6 +2625,10 @@ BOOL Rig_Poll()
|
|||
ConnecttoFLRIG(PORT);
|
||||
else if (PORT->PortType == RTLUDP)
|
||||
ConnecttoRTLUDP(PORT);
|
||||
// ---- G7TAJ ----
|
||||
else if (PORT->PortType == SDRANGEL)
|
||||
ConnecttoSDRANGEL(PORT);
|
||||
// ---- G7TAJ ----
|
||||
else if (PORT->HIDDevice)
|
||||
OpenHIDPort(PORT, PORT->IOBASE, PORT->SPEED);
|
||||
else if (PORT->PTC == 0
|
||||
|
@ -2632,7 +2717,12 @@ BOOL Rig_Poll()
|
|||
|
||||
case FLRIG:
|
||||
FLRIGPoll(PORT);
|
||||
break;
|
||||
// ---- G7TAJ ----
|
||||
case SDRANGEL:
|
||||
SDRANGELPoll(PORT);
|
||||
break; }
|
||||
// ---- G7TAJ ----
|
||||
}
|
||||
|
||||
// Build page for Web Display
|
||||
|
@ -3014,6 +3104,14 @@ BOOL RigWriteCommBlock(struct RIGPORTINFO * PORT)
|
|||
#ifndef WIN32
|
||||
BytesWritten = write(PORT->hDevice, PORT->TXBuffer, PORT->TXLen);
|
||||
#else
|
||||
DWORD Mask = 0;
|
||||
int Err;
|
||||
|
||||
Err = GetCommModemStatus(PORT->hDevice, &Mask);
|
||||
|
||||
if (Mask == 0) // trap com0com other end not open
|
||||
return TRUE;
|
||||
|
||||
fWriteStat = WriteFile(PORT->hDevice, PORT->TXBuffer, PORT->TXLen, &BytesWritten, NULL );
|
||||
#endif
|
||||
if (PORT->TXLen != BytesWritten)
|
||||
|
@ -5529,6 +5627,78 @@ struct RIGINFO * RigConfig(struct TNCINFO * TNC, char * buf, int Port)
|
|||
goto CheckOtherParams;
|
||||
}
|
||||
|
||||
// ---- G7TAJ ----
|
||||
|
||||
if (_memicmp(ptr, "sdrangel", 5) == 0)
|
||||
{
|
||||
// each instance (ip addr/port) of sdrangle can have one or more sampling devices (eg rltsdr) each with one ot
|
||||
// more channels (eg ssb demod, ssb mod). each set of sampling device = channel(s) is a device set.
|
||||
|
||||
// We poll all devices/channels at once. we one PORT record plus a RIG record for each channel
|
||||
|
||||
// Need parameters - Host:Port device channel. Device and Channel will default to zero
|
||||
|
||||
int device = 0, channel = 0;
|
||||
char * Name;
|
||||
char * nptr1;
|
||||
char * nptr2;
|
||||
|
||||
|
||||
ptr = strtok_s(NULL, " \t\n\r", &Context);
|
||||
|
||||
if (ptr == NULL || strlen(ptr) > 79) return FALSE;
|
||||
|
||||
Name = strtok_s(NULL, " \t\n\r", &Context);
|
||||
nptr1 = strtok_s(NULL, " \t\n\r", &Context);
|
||||
nptr2 = strtok_s(NULL, " \t\n\r", &Context);
|
||||
|
||||
if (nptr1 == 0 || nptr2 == 0 || Name == NULL || strlen(Name) > 9)
|
||||
return FALSE;
|
||||
|
||||
device = atoi(nptr1);
|
||||
channel = atoi(nptr2);
|
||||
|
||||
// Have a parameter to define port. Will decode it later
|
||||
|
||||
// See if already defined. PORT->IOBASE has Host:Port
|
||||
|
||||
for (i = 0; i < NumberofPorts; i++)
|
||||
{
|
||||
PORT = PORTInfo[i];
|
||||
|
||||
if (strcmp(PORT->IOBASE, ptr) == 0)
|
||||
goto AngelRigFound;
|
||||
}
|
||||
|
||||
// New Port
|
||||
|
||||
PORT = PORTInfo[NumberofPorts++] = zalloc(sizeof(struct RIGPORTINFO));
|
||||
PORT->PortType = SDRANGEL;
|
||||
PORT->ConfiguredRigs = 0;
|
||||
strcpy(PORT->IOBASE, ptr);
|
||||
|
||||
// Decode host
|
||||
|
||||
DecodeHAMLIBAddr(PORT, ptr);
|
||||
|
||||
|
||||
AngelRigFound:
|
||||
|
||||
RIG = &PORT->Rigs[PORT->ConfiguredRigs++];
|
||||
RIG->RIGOK = TRUE;
|
||||
RIG->PORT = PORT;
|
||||
RIG->RigAddr = device;
|
||||
RIG->Channel = channel;
|
||||
|
||||
strcpy(RIG->RigName, Name);
|
||||
|
||||
ptr = strtok_s(NULL, " \t\n\r", &Context);
|
||||
|
||||
// look for scan params
|
||||
|
||||
goto CheckOtherParams;
|
||||
}
|
||||
// ---- G7TAJ ----
|
||||
|
||||
if ((_memicmp(ptr, "VCOM", 4) == 0) && TNC->Hardware == H_SCS) // Using Radio Port on PTC
|
||||
COMPort = 0;
|
||||
|
@ -9633,8 +9803,616 @@ VOID ConnecttoRTLUDP(struct RIGPORTINFO * PORT)
|
|||
PORT->Alerted = TRUE;
|
||||
}
|
||||
|
||||
char * getObjectFromArray(char * Msg); // This gets the next object from an array ({} = object, [] = array
|
||||
|
||||
|
||||
|
||||
char * getArrayFromMsg(char * Msg)
|
||||
{
|
||||
// This gets the next object from an array ({} = object, [] = array
|
||||
// We look for the end of the object same number of { and }, teminate after } and return pointer to next object
|
||||
// So we have terminated Msg, and returned next object in array
|
||||
|
||||
// Only call if Msg is the next array in Msg
|
||||
|
||||
|
||||
char * ptr = Msg;
|
||||
char c;
|
||||
|
||||
int Open = 0;
|
||||
int Close = 0;
|
||||
|
||||
while (c = *(ptr++))
|
||||
{
|
||||
if (c == '[') Open ++; else if (c == ']') Close ++;
|
||||
|
||||
if (Open == Close)
|
||||
{
|
||||
*(ptr++) = 0;
|
||||
return ptr;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//----- G7TAJ -----
|
||||
|
||||
void ProcessSDRANGELFrame(struct RIGPORTINFO * PORT)
|
||||
{
|
||||
|
||||
int Length;
|
||||
|
||||
char * msg;
|
||||
char * rest;
|
||||
|
||||
struct RIGINFO * RIG;
|
||||
char * ptr, * ptr1, * ptr2, * ptr3, * pos;
|
||||
int Len, TotalLen;
|
||||
char cmd[80];
|
||||
char ReqBuf[256];
|
||||
char SendBuff[256];
|
||||
int chunklength;
|
||||
int headerlen;
|
||||
int i, n = 0;
|
||||
char * Sets;
|
||||
char * Rest;
|
||||
char * Set;
|
||||
int channelcount;
|
||||
char * channels;
|
||||
char * channel;
|
||||
char * samplingDevice;
|
||||
char * save;
|
||||
|
||||
//Debugprintf("Process SDRANGEL Frame %d\n", PORT->RXLen);
|
||||
|
||||
msg = PORT->RXBuffer;
|
||||
Length = PORT->RXLen;
|
||||
|
||||
msg[Length] = 0;
|
||||
|
||||
ptr1 = strstr(msg, "Transfer-Encoding: chunked" );
|
||||
|
||||
if (ptr1 == NULL)
|
||||
return;
|
||||
|
||||
ptr2 = strstr(ptr1, "\r\n\r\n");
|
||||
|
||||
if (ptr2 == NULL)
|
||||
return;
|
||||
|
||||
// ptr2 +4 points to the length of the first chunk (in hex), terminated by crlf
|
||||
|
||||
chunklength = (int)strtol(ptr2 + 4, &ptr3, 16);
|
||||
ptr3 += 2; // pointer to first chunk data
|
||||
headerlen = ptr3 - msg;
|
||||
|
||||
// make sure we have first chunk
|
||||
|
||||
if (chunklength + headerlen > Length)
|
||||
return;
|
||||
|
||||
PORT->RXLen = 0; //we have all the frame now
|
||||
PORT->Timeout = 0;
|
||||
|
||||
if (strstr(ptr3, "deviceSets") == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Message has info for all rigs
|
||||
|
||||
// As we mess with the message, save a copy and restore for each Rig
|
||||
|
||||
save = strdup(ptr3);
|
||||
|
||||
for (i = 0; i < PORT->ConfiguredRigs; i++)
|
||||
{
|
||||
strcpy(ptr3, save);
|
||||
n = 0;
|
||||
|
||||
RIG = &PORT->Rigs[i];
|
||||
RIG->RIGOK = 1;
|
||||
|
||||
// we can have one or more sampling devices (eg rltsdr) each with one or
|
||||
// more channels (eg ssb demod, ssb mod). each set of sampling device = channel(s) is a device set.
|
||||
|
||||
// Find Device Set for this device (in RIG->
|
||||
|
||||
// Message Structure is
|
||||
|
||||
//{
|
||||
// "deviceSets": [...].
|
||||
// "devicesetcount": 2,
|
||||
// "devicesetfocus": 0
|
||||
//}
|
||||
|
||||
// Get the device sets (JSON [..] is an array
|
||||
|
||||
Sets = strchr(ptr3, '[');
|
||||
|
||||
if (Sets == 0)
|
||||
continue;
|
||||
|
||||
Rest = getArrayFromMsg(Sets);
|
||||
|
||||
// Do we need to check devicesetcount ??. Maybe use to loop through sets, or just stop at end
|
||||
|
||||
// get the set for our device
|
||||
|
||||
while (RIG->RigAddr >= n)
|
||||
{
|
||||
Set = strchr(Sets, '{'); // Position to start of first Object
|
||||
|
||||
if (Set == 0)
|
||||
break;
|
||||
|
||||
Sets = getObjectFromArray(Set);
|
||||
n++;
|
||||
}
|
||||
|
||||
if (Set == 0)
|
||||
continue;
|
||||
|
||||
|
||||
// Now get the channel. looking for key "index":
|
||||
|
||||
// we could have a number of sampling devices and channels but for now get sampling device freq
|
||||
// and first channel freq. Channels are in an Array
|
||||
|
||||
if ((ptr = strstr(Set, "channelcount")) == 0)
|
||||
continue;
|
||||
|
||||
channelcount = atoi(&ptr[15]);
|
||||
|
||||
if ((channels = strchr(Set, '[')) == 0)
|
||||
continue;
|
||||
|
||||
samplingDevice = getArrayFromMsg(channels);
|
||||
|
||||
while(channelcount--)
|
||||
{
|
||||
channel = strchr(channels, '{');
|
||||
channels = getObjectFromArray(channel);
|
||||
|
||||
if ((ptr = strstr(channel, "index")))
|
||||
{
|
||||
n = atoi(&ptr[7]);
|
||||
if (n == RIG->Channel)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (pos = strstr(samplingDevice, "centerFrequency")) //"centerFrequency": 10489630000,
|
||||
{
|
||||
pos += 18;
|
||||
strncpy(cmd, pos, 20);
|
||||
RIG->RigFreq = atof(cmd) / 1000000.0;
|
||||
}
|
||||
|
||||
if (pos = strstr(channel, "deltaFrequency"))
|
||||
{
|
||||
pos += 17;
|
||||
strncpy(cmd, pos, 20);
|
||||
RIG->RigFreq += (atof(cmd) + RIG->rxOffset) / 1000000.0;;
|
||||
}
|
||||
|
||||
|
||||
_gcvt(RIG->RigFreq, 9, RIG->Valchar);
|
||||
|
||||
sprintf(RIG->WEB_FREQ,"%s", RIG->Valchar);
|
||||
SetWindowText(RIG->hFREQ, RIG->WEB_FREQ);
|
||||
|
||||
// we could get mode from Title line:
|
||||
//"title": "SSB Demodulator",
|
||||
|
||||
if (pos = strstr(channel, "title"))
|
||||
{
|
||||
pos += 9;
|
||||
strncpy(cmd, pos, 20);
|
||||
strlop(pos, ' ');
|
||||
strncpy(RIG->ModeString, pos, 15);
|
||||
sprintf(RIG->WEB_MODE, "%s", RIG->ModeString);
|
||||
SetWindowText(RIG->hMODE, RIG->WEB_MODE);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
while (msg && msg[0])
|
||||
{
|
||||
rest = strlop(msg, ',');
|
||||
|
||||
if ( pos = strstr(msg, "centerFrequency")) //"centerFrequency": 10489630000,
|
||||
{
|
||||
pos += 18;
|
||||
strncpy(cmd, pos,20);
|
||||
|
||||
RIG->RigFreq = atof(cmd) / 1000000.0;
|
||||
|
||||
// printf("FREQ=%f\t%s\n", RIG->RigFreq, cmd);
|
||||
|
||||
_gcvt(RIG->RigFreq, 9, RIG->Valchar);
|
||||
|
||||
sprintf(RIG->WEB_FREQ,"%s", RIG->Valchar);
|
||||
SetWindowText(RIG->hFREQ, RIG->WEB_FREQ);
|
||||
}
|
||||
|
||||
else if (memcmp(msg, "Mode:", 5) == 0)
|
||||
{
|
||||
if (strlen(&msg[6]) < 15)
|
||||
strcpy(RIG->ModeString, &msg[6]);
|
||||
}
|
||||
|
||||
else if (memcmp(msg, "Passband:", 9) == 0)
|
||||
{
|
||||
RIG->Passband = atoi(&msg[10]);
|
||||
sprintf(RIG->WEB_MODE, "%s/%d", RIG->ModeString, RIG->Passband);
|
||||
SetWindowText(RIG->hMODE, RIG->WEB_MODE);
|
||||
}
|
||||
|
||||
msg = rest;
|
||||
}
|
||||
*/
|
||||
free (save);
|
||||
}
|
||||
|
||||
|
||||
|
||||
VOID SDRANGELThread(struct RIGPORTINFO * PORT);
|
||||
|
||||
VOID ConnecttoSDRANGEL(struct RIGPORTINFO * PORT)
|
||||
{
|
||||
if (SDRANGELRunning)
|
||||
_beginthread(SDRANGELThread, 0, (void *)PORT);
|
||||
return ;
|
||||
}
|
||||
|
||||
VOID SDRANGELThread(struct RIGPORTINFO * PORT)
|
||||
{
|
||||
// Opens sockets and looks for data
|
||||
char Msg[255];
|
||||
int err, i, ret;
|
||||
u_long param=1;
|
||||
BOOL bcopt=TRUE;
|
||||
fd_set readfs;
|
||||
fd_set errorfs;
|
||||
struct timeval timeout;
|
||||
|
||||
if (PORT->CONNECTING)
|
||||
return;
|
||||
|
||||
PORT->RXLen = 0;
|
||||
|
||||
PORT->CONNECTING = 1;
|
||||
|
||||
if (PORT->remoteSock)
|
||||
{
|
||||
closesocket(PORT->remoteSock);
|
||||
}
|
||||
|
||||
PORT->remoteSock = 0;
|
||||
PORT->remoteSock = socket(AF_INET,SOCK_STREAM,0);
|
||||
|
||||
if (PORT->remoteSock == INVALID_SOCKET)
|
||||
{
|
||||
i=sprintf(Msg, "Socket Failed for SDRAngel socket - error code = %d\r\n", WSAGetLastError());
|
||||
WritetoConsole(Msg);
|
||||
|
||||
PORT->CONNECTING = FALSE;
|
||||
return;
|
||||
}
|
||||
|
||||
setsockopt(PORT->remoteSock, SOL_SOCKET, SO_REUSEADDR, (const char FAR *)&bcopt, 4);
|
||||
setsockopt(PORT->remoteSock, IPPROTO_TCP, TCP_NODELAY, (const char FAR *)&bcopt, 4);
|
||||
|
||||
if (connect(PORT->remoteSock,(LPSOCKADDR) &PORT->remoteDest,sizeof(PORT->remoteDest)) == 0)
|
||||
{
|
||||
//
|
||||
// Connected successful
|
||||
//
|
||||
|
||||
ioctl(PORT->remoteSock, FIONBIO, ¶m);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (PORT->Alerted == FALSE)
|
||||
{
|
||||
struct sockaddr_in * destaddr = (SOCKADDR_IN * )&PORT->remoteDest;
|
||||
|
||||
err = WSAGetLastError();
|
||||
|
||||
sprintf(Msg, "Connect Failed for SDRAngel socket - error code = %d Port %d\r\n",
|
||||
err, htons(destaddr->sin_port));
|
||||
|
||||
WritetoConsole(Msg);
|
||||
PORT->Alerted = TRUE;
|
||||
}
|
||||
|
||||
closesocket(PORT->remoteSock);
|
||||
|
||||
PORT->remoteSock = 0;
|
||||
PORT->CONNECTING = FALSE;
|
||||
return;
|
||||
}
|
||||
|
||||
PORT->CONNECTED = TRUE;
|
||||
PORT->CONNECTING = 0;
|
||||
|
||||
PORT->hDevice = (HANDLE)1; // simplifies check code
|
||||
|
||||
PORT->Alerted = TRUE;
|
||||
|
||||
while (PORT->CONNECTED && SDRANGELRunning)
|
||||
{
|
||||
FD_ZERO(&readfs);
|
||||
FD_ZERO(&errorfs);
|
||||
|
||||
FD_SET(PORT->remoteSock,&readfs);
|
||||
FD_SET(PORT->remoteSock,&errorfs);
|
||||
|
||||
timeout.tv_sec = 5;
|
||||
timeout.tv_usec = 0;
|
||||
|
||||
ret = select((int)PORT->remoteSock + 1, &readfs, NULL, &errorfs, &timeout);
|
||||
|
||||
if (SDRANGELRunning == 0)
|
||||
return;
|
||||
|
||||
if (ret == SOCKET_ERROR)
|
||||
{
|
||||
Debugprintf("SDRAngel Select failed %d ", WSAGetLastError());
|
||||
goto Lost;
|
||||
}
|
||||
|
||||
if (ret > 0)
|
||||
{
|
||||
// See what happened
|
||||
|
||||
if (FD_ISSET(PORT->remoteSock, &readfs))
|
||||
{
|
||||
SDRANGELProcessMessage(PORT);
|
||||
}
|
||||
|
||||
if (FD_ISSET(PORT->remoteSock, &errorfs))
|
||||
{
|
||||
Lost:
|
||||
sprintf(Msg, "SDRAngel Connection lost for Port %s\r\n", PORT->IOBASE);
|
||||
WritetoConsole(Msg);
|
||||
|
||||
PORT->CONNECTED = FALSE;
|
||||
PORT->Alerted = FALSE;
|
||||
PORT->hDevice = 0; // simplifies check code
|
||||
|
||||
closesocket(PORT->remoteSock);
|
||||
PORT->remoteSock = 0;
|
||||
return;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
}
|
||||
sprintf(Msg, "SDRAngel Thread Terminated Port %s\r\n", PORT->IOBASE);
|
||||
WritetoConsole(Msg);
|
||||
}
|
||||
|
||||
/*
|
||||
# 10489630000
|
||||
|
||||
CURL_DATA='{
|
||||
"deviceHwType": "RTLSDR",
|
||||
"direction": 0,
|
||||
"rtlSdrSettings": {
|
||||
"centerFrequency": "'$1'"
|
||||
}
|
||||
|
||||
}';
|
||||
|
||||
|
||||
curl -X PATCH "http://127.0.0.1:8091/sdrangel/deviceset/0/device/settings" \
|
||||
-H "accept: application/json" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "$CURL_DATA"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
VOID SDRANGELPoll(struct RIGPORTINFO * PORT)
|
||||
{
|
||||
UCHAR * Poll = PORT->TXBuffer;
|
||||
|
||||
// SDRAngel can have muliple rigs but we only need to poll once to get info for all rigs so just use first entry
|
||||
|
||||
struct RIGINFO * RIG = &PORT->Rigs[0];
|
||||
int Len, i;
|
||||
char ReqBuf[256];
|
||||
char SendBuff[256];
|
||||
//char * SDRANGEL_GETheader = "GET /sdrangel/deviceset/%d/device/settings "
|
||||
// "HTTP/1.1\nHost: %s\nConnection: keep-alive\n\r\n";
|
||||
|
||||
char * SDRANGEL_GETheader = "GET /sdrangel/devicesets "
|
||||
"HTTP/1.1\nHost: %s\nConnection: keep-alive\n\r\n";
|
||||
|
||||
|
||||
if (RIG->ScanStopped == 0)
|
||||
if (RIG->ScanCounter)
|
||||
RIG->ScanCounter--;
|
||||
|
||||
if (PORT->Timeout)
|
||||
{
|
||||
PORT->Timeout--;
|
||||
|
||||
if (PORT->Timeout) // Still waiting
|
||||
return;
|
||||
|
||||
// Loop through all Rigs
|
||||
|
||||
for (i = 0; i < PORT->ConfiguredRigs; i++)
|
||||
{
|
||||
RIG = &PORT->Rigs[i];
|
||||
|
||||
SetWindowText(RIG->hFREQ, "------------------");
|
||||
SetWindowText(RIG->hMODE, "----------");
|
||||
strcpy(RIG->WEB_FREQ, "-----------");;
|
||||
strcpy(RIG->WEB_MODE, "------");
|
||||
|
||||
RIG->RIGOK = FALSE;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Send Data if avail, else send poll
|
||||
|
||||
if (RIG->NumberofBands && RIG->RIGOK && (RIG->ScanStopped == 0))
|
||||
{
|
||||
if (RIG->ScanCounter <= 0)
|
||||
{
|
||||
// Send Next Freq
|
||||
|
||||
if (GetPermissionToChange(PORT, RIG))
|
||||
{
|
||||
char cmd[80];
|
||||
double freq;
|
||||
|
||||
if (RIG->RIG_DEBUG)
|
||||
Debugprintf("BPQ32 Change Freq to %9.4f", PORT->FreqPtr->Freq);
|
||||
|
||||
_gcvt(PORT->FreqPtr->Freq / 1000000.0, 9, RIG->Valchar); // For MH
|
||||
|
||||
// Send the Set Freq here, send set mode when we get a response
|
||||
|
||||
memcpy(&PORT->ScanEntry, PORT->FreqPtr, sizeof(struct ScanEntry));
|
||||
|
||||
//TODO
|
||||
sprintf(cmd, "%.0f", PORT->FreqPtr->Freq);
|
||||
SDRANGELSendCommand(PORT, "SETFREQ", cmd);
|
||||
|
||||
|
||||
PORT->CmdSent = 1;
|
||||
PORT->Retries = 0;
|
||||
PORT->Timeout = 10;
|
||||
PORT->AutoPoll = TRUE;
|
||||
|
||||
// There isn't a response to a set command, so clear Scan Lock here
|
||||
ReleasePermission(RIG); // Release Perrmission
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (RIG->PollCounter)
|
||||
{
|
||||
RIG->PollCounter--;
|
||||
if (RIG->PollCounter > 1)
|
||||
return;
|
||||
}
|
||||
|
||||
if (RIG->RIGOK && (RIG->ScanStopped == 0) && RIG->NumberofBands)
|
||||
return; // no point in reading freq if we are about to change it
|
||||
|
||||
RIG->PollCounter = 40;
|
||||
|
||||
// Read Frequency
|
||||
//TODO
|
||||
|
||||
|
||||
// Len = sprintf(SendBuff, SDRANGEL_GETheader, 0, &PORT->remoteDest ); // devicenum, host:port
|
||||
Len = sprintf(SendBuff, SDRANGEL_GETheader, &PORT->remoteDest ); // devicenum, host:port
|
||||
|
||||
if (PORT->CONNECTED)
|
||||
{
|
||||
if (send(PORT->remoteSock, SendBuff, Len, 0) != Len)
|
||||
{
|
||||
if (PORT->remoteSock)
|
||||
closesocket(PORT->remoteSock);
|
||||
|
||||
PORT->remoteSock = 0;
|
||||
PORT->CONNECTED = FALSE;
|
||||
PORT->hDevice = 0;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
PORT->Timeout = 10;
|
||||
PORT->CmdSent = 0;
|
||||
|
||||
PORT->AutoPoll = TRUE;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
VOID SDRANGELSendCommand(struct RIGPORTINFO * PORT, char * Command, char * Value)
|
||||
{
|
||||
int Len, ret;
|
||||
char ReqBuf[512];
|
||||
char SendBuff[512];
|
||||
char ValueString[256] ="";
|
||||
char * SDRANGEL_PATCHheader = "PATCH /sdrangel/deviceset/%d/device/settings "
|
||||
"HTTP/1.1\nHost: %s\n"
|
||||
"accept: application/json\n"
|
||||
"Content-Type: application/json\n"
|
||||
"Connection: keep-alive\n"
|
||||
"Content-length: %d\r\n"
|
||||
"\r\n%s";
|
||||
|
||||
if (!PORT->CONNECTED)
|
||||
return;
|
||||
|
||||
sprintf(ValueString, SDRANGEL_FREQ_DATA, "RTLSDR", Value);
|
||||
|
||||
Len = sprintf(SendBuff, SDRANGEL_PATCHheader, 0, &PORT->remoteDest, strlen(ValueString), ValueString);
|
||||
|
||||
ret = send(PORT->remoteSock, SendBuff, Len, 0);
|
||||
|
||||
if (ret != Len)
|
||||
{
|
||||
if (PORT->remoteSock)
|
||||
closesocket(PORT->remoteSock);
|
||||
|
||||
PORT->remoteSock = 0;
|
||||
PORT->CONNECTED = FALSE;
|
||||
PORT->hDevice = 0;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
void SDRANGELProcessMessage(struct RIGPORTINFO * PORT)
|
||||
{
|
||||
// Called from Background thread
|
||||
|
||||
int InputLen = recv(PORT->remoteSock, &PORT->RXBuffer[PORT->RXLen], 8192 - PORT->RXLen, 0);
|
||||
|
||||
if (InputLen == 0 || InputLen == SOCKET_ERROR)
|
||||
{
|
||||
if (PORT->remoteSock)
|
||||
closesocket(PORT->remoteSock);
|
||||
|
||||
PORT->remoteSock = 0;
|
||||
|
||||
PORT->CONNECTED = FALSE;
|
||||
PORT->hDevice = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
PORT->RXLen += InputLen;
|
||||
ProcessSDRANGELFrame(PORT);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ---- G7TAJ ----
|
||||
|
|
11
SCSPactor.c
11
SCSPactor.c
|
@ -1770,9 +1770,6 @@ VOID SCSPoll(int Port)
|
|||
|
||||
Buffer[datalen] = 0;
|
||||
|
||||
// Buffer has an ax.25 header, which we need to pick out and set as channel 0 Connect address
|
||||
// before sending the beacon
|
||||
|
||||
// If a Dragon with KISS over Hostmade we can just send it
|
||||
|
||||
if (TNC->DragonKISS)
|
||||
|
@ -1817,6 +1814,11 @@ VOID SCSPoll(int Port)
|
|||
return;
|
||||
}
|
||||
|
||||
// Not dragon KISS
|
||||
|
||||
// Buffer has an ax.25 header, which we need to pick out and set as channel 0 Connect address
|
||||
// before sending the beacon
|
||||
|
||||
// We also need to set Chan 0 Mycall so digi'ing can work, and put
|
||||
// it back after so incoming calls will work
|
||||
|
||||
|
@ -1824,7 +1826,6 @@ VOID SCSPoll(int Port)
|
|||
|
||||
// This doesn't seem to work
|
||||
|
||||
/*
|
||||
|
||||
ConvFromAX25(Buffer + 7, ICall); // Origin
|
||||
strlop(ICall, ' ');
|
||||
|
@ -1867,7 +1868,7 @@ VOID SCSPoll(int Port)
|
|||
1, Buffer, // Flag CmdSet as Data
|
||||
2, TNC->NodeCall); // Flag as Chan 0 Command
|
||||
}
|
||||
*/
|
||||
|
||||
ReleaseBuffer((UINT *)buffptr);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -188,7 +188,7 @@ VOID SENDBTMSG()
|
|||
if (Buffer)
|
||||
{
|
||||
memcpy(Buffer->DEST, PORT->PORTUNPROTO, 7);
|
||||
Buffer->DEST[6] |= 0xC0; // Set COmmand bits
|
||||
Buffer->DEST[6] |= 0xC0; // Set Command bits
|
||||
|
||||
// Send from BBSCALL unless PORTBCALL defined
|
||||
|
||||
|
|
|
@ -3368,7 +3368,7 @@ int DEDPROCESSHOSTPACKET(struct StreamInfo * Channel, struct TNCDATA * TNC)
|
|||
TRANSPORTENTRY * L4 = NULL;
|
||||
unsigned char * MONCURSOR=0;
|
||||
int SaveAuthProg = 0;
|
||||
|
||||
unsigned char * mcmdptr = &TNC->DEDTXBUFFER[1];
|
||||
TXBUFFERPTR = &TNC->DEDTXBUFFER[0];
|
||||
|
||||
if (Channel->Chan_TXQ == (UCHAR *)(ptrdiff_t) -1)
|
||||
|
@ -3522,10 +3522,8 @@ NOTDATA:
|
|||
Work = 0x31;
|
||||
else
|
||||
Work = 0x30;
|
||||
|
||||
}
|
||||
|
||||
|
||||
PUTCHARx(TNC, '0');
|
||||
PUTCHARx(TNC, ' ');
|
||||
PUTCHARx(TNC, Work);
|
||||
|
@ -3546,7 +3544,12 @@ NOTDATA:
|
|||
|
||||
// Support BPQ Extensions IUSC followed by optional port list
|
||||
|
||||
if (TNC->DEDTXBUFFER[1] == 'N')
|
||||
TNC->DEDTXBUFFER[TNC->MSGLENGTH] = 0;
|
||||
|
||||
if (*mcmdptr == ' ')
|
||||
mcmdptr++;
|
||||
|
||||
if (mcmdptr[0] == 'N')
|
||||
TNC->TRACEFLAG = 0;
|
||||
else
|
||||
{
|
||||
|
@ -3555,12 +3558,11 @@ NOTDATA:
|
|||
uint64_t mask = 0;
|
||||
|
||||
|
||||
TNC->DEDTXBUFFER[TNC->MSGLENGTH] = 0;
|
||||
ptr = strlop(TNC->DEDTXBUFFER, ' ');
|
||||
ptr = strlop(mcmdptr, ' ');
|
||||
|
||||
_strupr(TNC->DEDTXBUFFER);
|
||||
_strupr(mcmdptr);
|
||||
|
||||
if (strchr(TNC->DEDTXBUFFER, 'U'))
|
||||
if (strchr(mcmdptr, 'U'))
|
||||
TNC->MUIONLY = 1;
|
||||
|
||||
|
||||
|
@ -3574,8 +3576,9 @@ NOTDATA:
|
|||
if (port)
|
||||
{
|
||||
mask |= ((uint64_t)1 << (port - 1));
|
||||
ptr = ptr2;
|
||||
}
|
||||
ptr = ptr2;
|
||||
|
||||
}
|
||||
|
||||
if (mask)
|
||||
|
|
|
@ -780,6 +780,8 @@ scanCTEXT:
|
|||
}
|
||||
TCP->NumberofUsers += 1;
|
||||
}
|
||||
else if (_memicmp(errbuf, "WL2KREPORT", 10) == 0)
|
||||
TNC->WL2K = DecodeWL2KReportLine(errbuf);
|
||||
else if (_stricmp(param,"WebTermCSS") == 0)
|
||||
{
|
||||
TCP->WebTermCSS = _strdup(value);
|
||||
|
@ -2492,7 +2494,7 @@ nosocks:
|
|||
{
|
||||
Port = atoi(P2);
|
||||
|
||||
if (Port > 33 || TCP->CMDPort[Port] == 0)
|
||||
if (Port > MaxBPQPortNo || TCP->CMDPort[Port] == 0)
|
||||
{
|
||||
buffptr->Len = sprintf(&buffptr->Data[0], "Error - Invalid HOST Port\r");
|
||||
C_Q_ADD(&TNC->Streams[Stream].PACTORtoBPQ_Q, buffptr);
|
||||
|
|
|
@ -153,7 +153,7 @@ VOID QueueRaw(int Port, PMESSAGEX AXMSG, int Len)
|
|||
AXMSG->LENGTH = Len;
|
||||
AXMSG->CHAIN = 0; // Clear chain in new buffer
|
||||
|
||||
memcpy(AXCopy, AXMSG, Len + 10);
|
||||
memcpy(AXCopy, AXMSG, Len + 11);
|
||||
|
||||
GetSemaphore(&DGSemaphore, 0);
|
||||
|
||||
|
|
|
@ -10,14 +10,14 @@
|
|||
|
||||
#endif
|
||||
|
||||
#define KVers 6,0,24,2
|
||||
#define KVerstring "6.0.24.2\0"
|
||||
#define KVers 6,0,24,15
|
||||
#define KVerstring "6.0.24.15\0"
|
||||
|
||||
#ifdef CKernel
|
||||
|
||||
#define Vers KVers
|
||||
#define Verstring KVerstring
|
||||
#define Datestring "August 2023"
|
||||
#define Datestring "October 2023"
|
||||
#define VerComments "G8BPQ Packet Switch (C Version)" KVerstring
|
||||
#define VerCopyright "Copyright © 2001-2023 John Wiseman G8BPQ\0"
|
||||
#define VerDesc "BPQ32 Switch\0"
|
||||
|
|
45
WebMail.c
45
WebMail.c
|
@ -44,7 +44,7 @@ BOOL OkToKillMessage(BOOL SYSOP, char * Call, struct MsgInfo * Msg);
|
|||
int DisplayWebForm(struct HTTPConnectionInfo * Session, struct MsgInfo * Msg, char * FileName, char * XML, char * Reply, char * RawMessage, int RawLen);
|
||||
struct HTTPConnectionInfo * AllocateWebMailSession();
|
||||
VOID SaveNewMessage(struct HTTPConnectionInfo * Session, char * MsgPtr, char * Reply, int * RLen, char * Rest, int InputLen);
|
||||
void ConvertTitletoUTF8(char * Title, char * UTF8Title);
|
||||
void ConvertTitletoUTF8(WebMailInfo * WebMail, char * Title, char * UTF8Title, int Len);
|
||||
char *stristr (char *ch1, char *ch2);
|
||||
char * ReadTemplate(char * FormSet, char * DirName, char * FileName);
|
||||
VOID DoStandardTemplateSubsitutions(struct HTTPConnectionInfo * Session, char * txtFile);
|
||||
|
@ -906,7 +906,7 @@ int SendWebMailHeaderEx(char * Reply, char * Key, struct HTTPConnectionInfo * Se
|
|||
|
||||
if (Msg && CheckUserMsg(Msg, User->Call, User->flags & F_SYSOP))
|
||||
{
|
||||
char UTF8Title[128];
|
||||
char UTF8Title[4096];
|
||||
char * EncodedTitle;
|
||||
|
||||
// List if it is the right type and in the page range we want
|
||||
|
@ -934,7 +934,8 @@ int SendWebMailHeaderEx(char * Reply, char * Key, struct HTTPConnectionInfo * Se
|
|||
|
||||
EncodedTitle = doXMLTransparency(Msg->title);
|
||||
|
||||
ConvertTitletoUTF8(EncodedTitle, UTF8Title);
|
||||
memset(UTF8Title, 0, 4096); // In case convert fails part way through
|
||||
ConvertTitletoUTF8(Session->WebMail, EncodedTitle, UTF8Title, 4095);
|
||||
|
||||
free(EncodedTitle);
|
||||
|
||||
|
@ -971,7 +972,7 @@ int ViewWebMailMessage(struct HTTPConnectionInfo * Session, char * Reply, int Nu
|
|||
int msgLen;
|
||||
|
||||
char FullTo[100];
|
||||
char UTF8Title[128];
|
||||
char UTF8Title[4096];
|
||||
int Index;
|
||||
char * crcrptr;
|
||||
char DownLoad[256] = "";
|
||||
|
@ -1009,7 +1010,8 @@ int ViewWebMailMessage(struct HTTPConnectionInfo * Session, char * Reply, int Nu
|
|||
|
||||
// make sure title is UTF 8 encoded
|
||||
|
||||
ConvertTitletoUTF8(Msg->title, UTF8Title);
|
||||
memset(UTF8Title, 0, 4096); // In case convert fails part way through
|
||||
ConvertTitletoUTF8(Session->WebMail, Msg->title, UTF8Title, 4095);
|
||||
|
||||
// if a B2 message diplay B2 Header instead of a locally generated one
|
||||
|
||||
|
@ -1246,17 +1248,28 @@ int ViewWebMailMessage(struct HTTPConnectionInfo * Session, char * Reply, int Nu
|
|||
msgLen = len - 1; // exclude NULL
|
||||
|
||||
#else
|
||||
int left = 2 * msgLen;
|
||||
int len = msgLen;
|
||||
size_t left = 2 * msgLen;
|
||||
size_t len = msgLen;
|
||||
int ret;
|
||||
UCHAR * BufferBP = BufferB;
|
||||
iconv_t * icu = NULL;
|
||||
char * orig = MsgBytes;
|
||||
MsgBytes[msgLen] = 0;
|
||||
|
||||
iconv_t * icu = Session->WebMail->iconv_toUTF8;
|
||||
|
||||
if (icu == NULL)
|
||||
icu = iconv_open("UTF-8", "CP1252");
|
||||
icu = Session->WebMail->iconv_toUTF8 = iconv_open("UTF-8//IGNORE", "CP1252");
|
||||
|
||||
if (icu == (iconv_t) -1)
|
||||
{
|
||||
Session->WebMail->iconv_toUTF8 = NULL;
|
||||
strcpy(BufferB, MsgBytes);
|
||||
}
|
||||
else
|
||||
{
|
||||
iconv(icu, NULL, NULL, NULL, NULL); // Reset State Machine
|
||||
iconv(icu, &MsgBytes, &len, (char ** __restrict__)&BufferBP, &left);
|
||||
|
||||
ret = iconv(icu, &MsgBytes, &len, (char ** __restrict__)&BufferBP, &left);
|
||||
}
|
||||
free(Save);
|
||||
Save = MsgBytes = BufferB;
|
||||
msgLen = strlen(MsgBytes);
|
||||
|
@ -1407,6 +1420,11 @@ void FreeWebMailFields(WebMailInfo * WebMail)
|
|||
SaveReply = WebMail->Reply;
|
||||
SaveRlen = WebMail->RLen;
|
||||
|
||||
#ifndef WIN32
|
||||
if (WebMail->iconv_toUTF8)
|
||||
iconv_close(WebMail->iconv_toUTF8);
|
||||
#endif
|
||||
|
||||
memset(WebMail, 0, sizeof(WebMailInfo));
|
||||
|
||||
WebMail->Reply = SaveReply;
|
||||
|
@ -6098,7 +6116,7 @@ int ProcessWebmailWebSock(char * MsgPtr, char * OutBuffer)
|
|||
|
||||
if (Msg && CheckUserMsg(Msg, User->Call, User->flags & F_SYSOP))
|
||||
{
|
||||
char UTF8Title[128];
|
||||
char UTF8Title[4096];
|
||||
char * EncodedTitle;
|
||||
|
||||
// List if it is the right type and in the page range we want
|
||||
|
@ -6126,7 +6144,8 @@ int ProcessWebmailWebSock(char * MsgPtr, char * OutBuffer)
|
|||
|
||||
EncodedTitle = doXMLTransparency(Msg->title);
|
||||
|
||||
ConvertTitletoUTF8(EncodedTitle, UTF8Title);
|
||||
memset(UTF8Title, 0, 4096); // In case convert fails part way through
|
||||
ConvertTitletoUTF8(Session->WebMail, EncodedTitle, UTF8Title, 4095);
|
||||
|
||||
free(EncodedTitle);
|
||||
|
||||
|
|
|
@ -689,6 +689,7 @@ typedef struct PORTCONTROL
|
|||
time_t LastSmartIDTime; // For SmartID - ID only if packets sent recently
|
||||
time_t SmartIDNeeded; // Time to send next smart ID
|
||||
time_t SmartIDInterval; // Smart ID Interval (Secs)
|
||||
int SendtoM0LTEMap;
|
||||
|
||||
} PORTCONTROLX, *PPORTCONTROL;
|
||||
|
||||
|
@ -890,6 +891,9 @@ typedef struct _LINKTABLE
|
|||
|
||||
UCHAR SESSACTIVE; // SET WHEN WE ARE SURE SESSION IS UP
|
||||
|
||||
UINT APPLMASK; // Used when XIR processed
|
||||
VOID * ALIASPTR;
|
||||
|
||||
USHORT KILLTIMER; // TIME TO KILL IDLE LINK
|
||||
|
||||
VOID * CIRCUITPOINTER; // POINTER TO L4 CIRCUIT TABLE ENTRY
|
||||
|
|
|
@ -70,6 +70,9 @@
|
|||
// Allow /History to be shortened to /Hi (45)
|
||||
// Fix extra r charater in Chat Config Web Page
|
||||
|
||||
|
||||
// Increase sise of status display buffers (7)
|
||||
|
||||
#include "BPQChat.h"
|
||||
#include "Dbghelp.h"
|
||||
|
||||
|
|
30
bpqmail.h
30
bpqmail.h
|
@ -22,6 +22,10 @@
|
|||
#define LIBCONFIG_STATIC
|
||||
#include <libconfig.h>
|
||||
|
||||
#ifndef WIN32
|
||||
#include <iconv.h>
|
||||
#endif
|
||||
|
||||
#include "compatbits.h"
|
||||
|
||||
#ifndef LINBPQ
|
||||
|
@ -941,6 +945,23 @@ typedef struct SocketConnectionInfo
|
|||
|
||||
} SocketConn;
|
||||
|
||||
// FBB reject.sys like filters
|
||||
|
||||
typedef struct FBBFILTER
|
||||
{
|
||||
struct FBBFILTER * Next;
|
||||
char Action;
|
||||
char Type;
|
||||
char From[10];
|
||||
char AT[10];
|
||||
char TO[10];
|
||||
char BID[16];
|
||||
int MaxLen;
|
||||
|
||||
} FBBFilter;
|
||||
|
||||
extern FBBFilter * Filters;
|
||||
|
||||
typedef struct KEYVALUES
|
||||
{
|
||||
char * Key;
|
||||
|
@ -994,6 +1015,11 @@ typedef struct WEBMAILINFO
|
|||
BOOL Packet;
|
||||
|
||||
int CurrentMessageIndex; // Index of message currently displayed (for Prev and Next)
|
||||
#ifdef WIN32
|
||||
void * iconv_toUTF8; // Used on Linux for char set conversion
|
||||
#else
|
||||
iconv_t * iconv_toUTF8; // Used on Linux for char set conversion
|
||||
#endif
|
||||
|
||||
}WebMailInfo;
|
||||
|
||||
|
@ -1210,8 +1236,8 @@ BOOL ConnecttoBBS (struct UserInfo * user);
|
|||
BOOL SetupNewBBS(struct UserInfo * user);
|
||||
VOID CreateRegBackup();
|
||||
VOID SaveFilters(HWND hDlg);
|
||||
BOOL CheckRejFilters(char * From, char * To, char * ATBBS, char * BID, char Type);
|
||||
BOOL CheckHoldFilters(char * From, char * To, char * ATBBS, char * BID);
|
||||
BOOL CheckRejFilters(char * From, char * To, char * ATBBS, char * BID, char Type, int Len);
|
||||
BOOL CheckHoldFilters(struct MsgInfo * Msg, char * From, char * To, char * ATBBS, char * BID);
|
||||
BOOL CheckifLocalRMSUser(char * FullTo);
|
||||
VOID DoWPLookup(ConnectionInfo * conn, struct UserInfo * user, char Type, char *Context);
|
||||
BOOL wildcardcompare(char * Target, char * Match);
|
||||
|
|
1604
bpqmail.h.bak
1604
bpqmail.h.bak
File diff suppressed because it is too large
Load Diff
7
cMain.c
7
cMain.c
|
@ -139,6 +139,7 @@ extern BOOL ADIFLogEnabled;
|
|||
extern UCHAR LogDirectory[260];
|
||||
extern BOOL EventsEnabled;
|
||||
extern BOOL SaveAPRSMsgs;
|
||||
BOOL M0LTEMap = FALSE;
|
||||
|
||||
//TNCTABLE DD 0
|
||||
//NUMBEROFSTREAMS DD 0
|
||||
|
@ -788,6 +789,8 @@ BOOL Start()
|
|||
ADIFLogEnabled = cfg->C_ADIF;
|
||||
EventsEnabled = cfg->C_EVENTS;
|
||||
SaveAPRSMsgs = cfg->C_SaveAPRSMsgs;
|
||||
M0LTEMap = cfg->C_M0LTEMap;
|
||||
|
||||
|
||||
// Get pointers to PASSWORD and APPL1 commands
|
||||
|
||||
|
@ -939,6 +942,7 @@ BOOL Start()
|
|||
PORT->QUAL_ADJUST = (UCHAR)PortRec->QUALADJUST;
|
||||
|
||||
PORT->DIGIFLAG = PortRec->DIGIFLAG;
|
||||
if (PortRec->DIGIPORT && CanPortDigi(PortRec->DIGIPORT))
|
||||
PORT->DIGIPORT = PortRec->DIGIPORT;
|
||||
PORT->DIGIMASK = PortRec->DIGIMASK;
|
||||
PORT->USERS = (UCHAR)PortRec->USERS;
|
||||
|
@ -1074,6 +1078,8 @@ BOOL Start()
|
|||
KISS->KISSCMD = realloc(KISS->KISSCMD, KISS->KISSCMDLEN);
|
||||
}
|
||||
|
||||
PORT->SendtoM0LTEMap = PortRec->SendtoM0LTEMap;
|
||||
|
||||
if (PortRec->BBSFLAG) // Appl 1 not permitted - BBSFLAG=NOBBS
|
||||
PORT->PERMITTEDAPPLS &= 0xfffffffe; // Clear bottom bit
|
||||
|
||||
|
@ -2075,7 +2081,6 @@ VOID TIMERINTERRUPT()
|
|||
|
||||
L3FastTimer();
|
||||
L4TimerProc();
|
||||
|
||||
}
|
||||
|
||||
// SEE IF ANY FRAMES TO TRACE
|
||||
|
|
|
@ -54,7 +54,6 @@ uintptr_t _beginthread(void(__cdecl *start_address)(void *), unsigned stack_size
|
|||
#else
|
||||
|
||||
int Sleep(int ms);
|
||||
int GetTickCount();
|
||||
|
||||
#define ioctlsocket ioctl
|
||||
|
||||
|
@ -142,6 +141,9 @@ typedef DWORD COLORREF;
|
|||
#define MoveFile rename
|
||||
#define CreateDirectory mkdir
|
||||
|
||||
uint64_t GetTickCount();
|
||||
|
||||
|
||||
int sprintf_s(char * string, int plen, const char * format, ...);
|
||||
|
||||
|
||||
|
|
28
config.c
28
config.c
|
@ -300,7 +300,8 @@ static char *keywords[] =
|
|||
"APPL1QUAL", "APPL2QUAL", "APPL3QUAL", "APPL4QUAL",
|
||||
"APPL5QUAL", "APPL6QUAL", "APPL7QUAL", "APPL8QUAL",
|
||||
"BTEXT:", "NETROMCALL", "C_IS_CHAT", "MAXRTT", "MAXHOPS", // IPGATEWAY= no longer allowed
|
||||
"LogL4Connects", "LogAllConnects", "SAVEMH", "ENABLEADIFLOG", "ENABLEEVENTS", "SAVEAPRSMSGS"
|
||||
"LogL4Connects", "LogAllConnects", "SAVEMH", "ENABLEADIFLOG", "ENABLEEVENTS", "SAVEAPRSMSGS",
|
||||
"EnableM0LTEMap"
|
||||
}; /* parameter keywords */
|
||||
|
||||
static void * offset[] =
|
||||
|
@ -320,7 +321,8 @@ static void * offset[] =
|
|||
&xxcfg.C_APPL[0].ApplQual, &xxcfg.C_APPL[1].ApplQual, &xxcfg.C_APPL[2].ApplQual, &xxcfg.C_APPL[3].ApplQual,
|
||||
&xxcfg.C_APPL[4].ApplQual, &xxcfg.C_APPL[5].ApplQual, &xxcfg.C_APPL[6].ApplQual, &xxcfg.C_APPL[7].ApplQual,
|
||||
&xxcfg.C_BTEXT, &xxcfg.C_NETROMCALL, &xxcfg.C_C, &xxcfg.C_MAXRTT, &xxcfg.C_MAXHOPS, // IPGATEWAY= no longer allowed
|
||||
&xxcfg.C_LogL4Connects, &xxcfg.C_LogAllConnects, &xxcfg.C_SaveMH, &xxcfg.C_ADIF, &xxcfg.C_EVENTS, &xxcfg.C_SaveAPRSMsgs}; /* offset for corresponding data in config file */
|
||||
&xxcfg.C_LogL4Connects, &xxcfg.C_LogAllConnects, &xxcfg.C_SaveMH, &xxcfg.C_ADIF, &xxcfg.C_EVENTS, &xxcfg.C_SaveAPRSMsgs,
|
||||
&xxcfg.C_M0LTEMap}; /* offset for corresponding data in config file */
|
||||
|
||||
static int routine[] =
|
||||
{
|
||||
|
@ -339,7 +341,8 @@ static int routine[] =
|
|||
14, 14, 14, 14,
|
||||
14, 14 ,14, 14,
|
||||
15, 0, 2, 9, 9,
|
||||
2, 2, 2, 2, 2, 2} ; // Routine to process param
|
||||
2, 2, 2, 2, 2, 2,
|
||||
2} ; // Routine to process param
|
||||
|
||||
int PARAMLIM = sizeof(routine)/sizeof(int);
|
||||
//int NUMBEROFKEYWORDS = sizeof(routine)/sizeof(int);
|
||||
|
@ -361,7 +364,7 @@ static char *pkeywords[] =
|
|||
"BCALL", "DIGIMASK", "NOKEEPALIVES", "COMPORT", "DRIVER", "WL2KREPORT", "UIONLY",
|
||||
"UDPPORT", "IPADDR", "I2CBUS", "I2CDEVICE", "UDPTXPORT", "UDPRXPORT", "NONORMALIZE",
|
||||
"IGNOREUNLOCKEDROUTES", "INP3ONLY", "TCPPORT", "RIGPORT", "PERMITTEDAPPLS", "HIDE",
|
||||
"SMARTID", "KISSCOMMAND"}; /* parameter keywords */
|
||||
"SMARTID", "KISSCOMMAND", "SendtoM0LTEMap"}; /* parameter keywords */
|
||||
|
||||
static void * poffset[] =
|
||||
{
|
||||
|
@ -375,7 +378,7 @@ static void * poffset[] =
|
|||
&xxp.BCALL, &xxp.DIGIMASK, &xxp.DefaultNoKeepAlives, &xxp.IOADDR, &xxp.DLLNAME, &xxp.WL2K, &xxp.UIONLY,
|
||||
&xxp.IOADDR, &xxp.IPADDR, &xxp.INTLEVEL, &xxp.IOADDR, &xxp.IOADDR, &xxp.ListenPort, &xxp.NoNormalize,
|
||||
&xxp.IGNOREUNLOCKED, &xxp.INP3ONLY, &xxp.TCPPORT, &xxp.RIGPORT, &xxp.PERMITTEDAPPLS, &xxp.Hide,
|
||||
&xxp.SmartID, &xxp.KissParams}; /* offset for corresponding data in config file */
|
||||
&xxp.SmartID, &xxp.KissParams, &xxp.SendtoM0LTEMap}; /* offset for corresponding data in config file */
|
||||
|
||||
static int proutine[] =
|
||||
{
|
||||
|
@ -389,7 +392,7 @@ static int proutine[] =
|
|||
0, 1, 2, 18, 15, 16, 2,
|
||||
1, 17, 1, 1, 1, 1, 2,
|
||||
2, 2, 1, 1, 19, 2,
|
||||
1, 20}; /* routine to process parameter */
|
||||
1, 20, 1}; /* routine to process parameter */
|
||||
|
||||
int PPARAMLIM = sizeof(proutine)/sizeof(int);
|
||||
|
||||
|
@ -427,6 +430,9 @@ char bbscall[11];
|
|||
char bbsalias[11];
|
||||
int bbsqual;
|
||||
|
||||
|
||||
extern UCHAR ConfigDirectory[260];
|
||||
|
||||
BOOL LocSpecified = FALSE;
|
||||
|
||||
/************************************************************************/
|
||||
|
@ -485,13 +491,13 @@ BOOL ProcessConfig()
|
|||
|
||||
Consoleprintf("Configuration file Preprocessor.");
|
||||
|
||||
if (BPQDirectory[0] == 0)
|
||||
if (ConfigDirectory[0] == 0)
|
||||
{
|
||||
strcpy(inputname, "bpq32.cfg");
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(inputname,BPQDirectory);
|
||||
strcpy(inputname,ConfigDirectory);
|
||||
strcat(inputname,"/");
|
||||
strcat(inputname, "bpq32.cfg");
|
||||
}
|
||||
|
@ -597,6 +603,8 @@ BOOL ProcessConfig()
|
|||
paramok[77]=1; // ENABLEADIFLOG optional
|
||||
paramok[78]=1; // EnableEvents optional
|
||||
paramok[79]=1; // SaveAPRSMsgs optional
|
||||
paramok[79]=1; // SaveAPRSMsgs optional
|
||||
paramok[80]=1; // EnableM0LTEMap optional
|
||||
|
||||
for (i=0; i < PARAMLIM; i++)
|
||||
{
|
||||
|
@ -1624,6 +1632,8 @@ int ports(int i)
|
|||
heading = 1;
|
||||
}
|
||||
|
||||
xxp.SendtoM0LTEMap = 1; // Default to enabled
|
||||
|
||||
while (endport == 0 && !feof(fp1))
|
||||
{
|
||||
GetNextLine(rec);
|
||||
|
@ -2927,7 +2937,7 @@ BOOL ProcessAPPLDef(char * buf)
|
|||
|
||||
Appl = atoi(Param[0]);
|
||||
|
||||
if (Appl < 1 || Appl > 32) return FALSE;
|
||||
if (Appl < 1 || Appl > NumberofAppls) return FALSE;
|
||||
|
||||
App = &xxcfg.C_APPL[Appl - 1]; // Recs from zero
|
||||
|
||||
|
|
|
@ -73,10 +73,11 @@ struct PORTCONFIG
|
|||
unsigned int PERMITTEDAPPLS; // Appls allowed on this port
|
||||
int HavePermittedAppls; // Indicated PERMITTEDAPPLS uses
|
||||
int Hide; // Don't show on Ports display or AGW Connect Menu
|
||||
long long txOffset; // Transverter tx offset
|
||||
long long rxOffset; // Transverter rx offset ppa
|
||||
// long long txOffset; // Transverter tx offset
|
||||
// long long rxOffset; // Transverter rx offset ppa
|
||||
int SmartID;
|
||||
unsigned char * KissParams;
|
||||
int SendtoM0LTEMap;
|
||||
};
|
||||
|
||||
struct ROUTECONFIG
|
||||
|
@ -149,6 +150,7 @@ struct CONFIGTABLE
|
|||
UCHAR C_EVENTS;
|
||||
UCHAR C_LogAllConnects;
|
||||
UCHAR C_SaveAPRSMsgs;
|
||||
UCHAR C_M0LTEMap;
|
||||
UCHAR C_VERSION; // CONFIG PROG VERSION
|
||||
// Reuse C_APPLICATIONS - no longer used
|
||||
char C_NETROMCALL[10];
|
||||
|
|
|
@ -50,6 +50,7 @@ char LOC[7] = ""; // Must be in shared mem// Maidenhead Locator for Reporting
|
|||
char ReportDest[7];
|
||||
|
||||
UCHAR BPQDirectory[260] = ".";
|
||||
UCHAR ConfigDirectory[260] = ".";
|
||||
UCHAR LogDirectory[260] = "";
|
||||
UCHAR BPQProgramDirectory[260]="";
|
||||
|
||||
|
|
|
@ -0,0 +1,715 @@
|
|||
/*
|
||||
* getopt.c
|
||||
*
|
||||
* $Id: getopt.c,v 1.9 2009/02/08 18:02:17 keithmarshall Exp $
|
||||
*
|
||||
* Implementation of the `getopt', `getopt_long' and `getopt_long_only'
|
||||
* APIs, for inclusion in the MinGW runtime library.
|
||||
*
|
||||
* This file is part of the MinGW32 package set.
|
||||
*
|
||||
* Contributed by Keith Marshall <keithmarshall@users.sourceforge.net>
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS NOT COPYRIGHTED
|
||||
*
|
||||
* This source code is offered for use in the public domain. You may
|
||||
* use, modify or distribute it freely.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful but
|
||||
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
|
||||
* DISCLAIMED. This includes but is not limited to warranties of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Revision: 1.9 $
|
||||
* $Author: keithmarshall $
|
||||
* $Date: 2009/02/08 18:02:17 $
|
||||
*
|
||||
*/
|
||||
|
||||
// Modified a little to compile as C code, John Wiseman 2018
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include "getopt.h"
|
||||
|
||||
/* Identify how to get the calling program name, for use in messages...
|
||||
*/
|
||||
#ifdef __CYGWIN__
|
||||
/*
|
||||
* CYGWIN uses this DLL reference...
|
||||
*/
|
||||
# define PROGNAME __progname
|
||||
extern char __declspec(dllimport) *__progname;
|
||||
#else
|
||||
/*
|
||||
* ...while elsewhere, we simply use the first argument passed.
|
||||
*/
|
||||
# define PROGNAME *argv
|
||||
#endif
|
||||
|
||||
/* Initialise the public variables. */
|
||||
|
||||
int optind = 1; /* index for first non-option arg */
|
||||
int opterr = 1; /* enable built-in error messages */
|
||||
|
||||
char *optarg = NULL; /* pointer to current option argument */
|
||||
|
||||
#define CHAR char /* argument type selector */
|
||||
|
||||
#define getopt_switchar '-' /* option prefix character in argv */
|
||||
#define getopt_pluschar '+' /* prefix for POSIX mode in optstring */
|
||||
#define getopt_takes_argument ':' /* marker for optarg in optstring */
|
||||
#define getopt_arg_assign '=' /* longopt argument field separator */
|
||||
#define getopt_unknown '?' /* return code for unmatched option */
|
||||
#define getopt_ordered 1 /* return code for ordered non-option */
|
||||
|
||||
#define getopt_all_done -1 /* return code to indicate completion */
|
||||
|
||||
enum
|
||||
{ /* All `getopt' API functions are implemented via calls to the
|
||||
* common static function `getopt_parse()'; these `mode' selectors
|
||||
* determine the behaviour of `getopt_parse()', to deliver the
|
||||
* appropriate result in each case.
|
||||
*/
|
||||
getopt_mode_standard = 0, /* getopt() */
|
||||
getopt_mode_long, /* getopt_long() */
|
||||
getopt_mode_long_only /* getopt_long_only() */
|
||||
};
|
||||
|
||||
enum
|
||||
{ /* When attempting to match a command line argument to a long form option,
|
||||
* these indicate the status of the match.
|
||||
*/
|
||||
getopt_no_match = 0, /* no successful match */
|
||||
getopt_abbreviated_match, /* argument is an abbreviation for an option */
|
||||
getopt_exact_match /* argument matches the full option name */
|
||||
};
|
||||
|
||||
int optopt = getopt_unknown; /* return value for option being evaluated */
|
||||
|
||||
/* Some BSD applications expect to be able to reinitialise `getopt' parsing
|
||||
* by setting a global variable called `optreset'. We provide an obfuscated
|
||||
* API, which allows applications to emulate this brain damage; however, any
|
||||
* use of this is non-portable, and is strongly discouraged.
|
||||
*/
|
||||
#define optreset __mingw_optreset
|
||||
int optreset = 0;
|
||||
|
||||
int getopt_missing_arg( const CHAR *optstring )
|
||||
{
|
||||
/* Helper function to determine the appropriate return value,
|
||||
* for the case where a required option argument is missing.
|
||||
*/
|
||||
if( (*optstring == getopt_pluschar) || (*optstring == getopt_switchar) )
|
||||
++optstring;
|
||||
return (*optstring == getopt_takes_argument)
|
||||
? getopt_takes_argument
|
||||
: getopt_unknown;
|
||||
}
|
||||
|
||||
/* `complain' macro facilitates the generation of simple built-in
|
||||
* error messages, displayed on various fault conditions, provided
|
||||
* `opterr' is non-zero.
|
||||
*/
|
||||
#define complain( MSG, ARG ) if( opterr ) \
|
||||
fprintf( stderr, "%s: "MSG"\n", PROGNAME, ARG )
|
||||
|
||||
|
||||
int getopt_argerror( int mode, char *fmt, CHAR *prog, struct option *opt, int retval )
|
||||
{
|
||||
/* Helper function, to generate more complex built-in error
|
||||
* messages, for invalid arguments to long form options ...
|
||||
*/
|
||||
if( opterr )
|
||||
{
|
||||
/* ... but, displayed only if `opterr' is non-zero.
|
||||
*/
|
||||
char flag[] = "--";
|
||||
if( mode != getopt_mode_long )
|
||||
/*
|
||||
* only display one hyphen, for implicit long form options,
|
||||
* improperly resolved by `getopt_long_only()'.
|
||||
*/
|
||||
flag[1] = 0;
|
||||
/*
|
||||
* always preface the program name ...
|
||||
*/
|
||||
fprintf( stderr, "%s: ", prog );
|
||||
/*
|
||||
* to the appropriate, option specific message.
|
||||
*/
|
||||
fprintf( stderr, fmt, flag, opt->name );
|
||||
}
|
||||
/* Whether displaying the message, or not, always set `optopt'
|
||||
* to identify the faulty option ...
|
||||
*/
|
||||
optopt = opt->val;
|
||||
/*
|
||||
* and return the `invalid option' indicator.
|
||||
*/
|
||||
return retval;
|
||||
}
|
||||
|
||||
/* `getopt_conventions' establish behavioural options, to control
|
||||
* the operation of `getopt_parse()', e.g. to select between POSIX
|
||||
* and GNU style argument parsing behaviour.
|
||||
*/
|
||||
#define getopt_set_conventions 0x1000
|
||||
#define getopt_posixly_correct 0x0010
|
||||
|
||||
|
||||
int getopt_conventions( int flags )
|
||||
{
|
||||
static int conventions = 0;
|
||||
|
||||
if( (conventions == 0) && ((flags & getopt_set_conventions) == 0) )
|
||||
{
|
||||
/* default conventions have not yet been established;
|
||||
* initialise them now!
|
||||
*/
|
||||
conventions = getopt_set_conventions;
|
||||
|
||||
}
|
||||
|
||||
else if( flags & getopt_set_conventions )
|
||||
/*
|
||||
* default conventions may have already been established,
|
||||
* but this is a specific request to augment them.
|
||||
*/
|
||||
conventions |= flags;
|
||||
|
||||
/* in any event, return the currently established conventions.
|
||||
*/
|
||||
return conventions;
|
||||
}
|
||||
|
||||
int is_switchar( CHAR flag )
|
||||
{
|
||||
/* A simple helper function, used to identify the switch character
|
||||
* introducing an optional command line argument.
|
||||
*/
|
||||
return flag == getopt_switchar;
|
||||
}
|
||||
|
||||
const CHAR *getopt_match( CHAR lookup, const CHAR *opt_string )
|
||||
{
|
||||
/* Helper function, used to identify short form options.
|
||||
*/
|
||||
if( (*opt_string == getopt_pluschar) || (*opt_string == getopt_switchar) )
|
||||
++opt_string;
|
||||
if( *opt_string == getopt_takes_argument )
|
||||
++opt_string;
|
||||
do if( lookup == *opt_string ) return opt_string;
|
||||
while( *++opt_string );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int getopt_match_long( const CHAR *nextchar, const CHAR *optname )
|
||||
{
|
||||
/* Helper function, used to identify potential matches for
|
||||
* long form options.
|
||||
*/
|
||||
CHAR matchchar;
|
||||
while( (matchchar = *nextchar++) && (matchchar == *optname) )
|
||||
/*
|
||||
* skip over initial substring which DOES match.
|
||||
*/
|
||||
++optname;
|
||||
|
||||
if( matchchar )
|
||||
{
|
||||
/* did NOT match the entire argument to an initial substring
|
||||
* of a defined option name ...
|
||||
*/
|
||||
if( matchchar != getopt_arg_assign )
|
||||
/*
|
||||
* ... and didn't stop at an `=' internal field separator,
|
||||
* so this is NOT a possible match.
|
||||
*/
|
||||
return getopt_no_match;
|
||||
|
||||
/* DID stop at an `=' internal field separator,
|
||||
* so this IS a possible match, and what follows is an
|
||||
* argument to the possibly matched option.
|
||||
*/
|
||||
optarg = (char *)(nextchar);
|
||||
}
|
||||
return *optname
|
||||
/*
|
||||
* if we DIDN'T match the ENTIRE text of the option name,
|
||||
* then it's a possible abbreviated match ...
|
||||
*/
|
||||
? getopt_abbreviated_match
|
||||
/*
|
||||
* but if we DID match the entire option name,
|
||||
* then it's a DEFINITE EXACT match.
|
||||
*/
|
||||
: getopt_exact_match;
|
||||
}
|
||||
|
||||
int getopt_resolved( int mode, int argc, CHAR *const *argv, int *argind,
|
||||
struct option *opt, int index, int *retindex, const CHAR *optstring )
|
||||
{
|
||||
/* Helper function to establish appropriate return conditions,
|
||||
* on resolution of a long form option.
|
||||
*/
|
||||
if( retindex != NULL )
|
||||
*retindex = index;
|
||||
|
||||
/* On return, `optind' should normally refer to the argument, if any,
|
||||
* which follows the current one; it is convenient to set this, before
|
||||
* checking for the presence of any `optarg'.
|
||||
*/
|
||||
optind = *argind + 1;
|
||||
|
||||
if( optarg && (opt[index].has_arg == no_argument) )
|
||||
/*
|
||||
* it is an error for the user to specify an option specific argument
|
||||
* with an option which doesn't expect one!
|
||||
*/
|
||||
return getopt_argerror( mode, "option `%s%s' doesn't accept an argument\n",
|
||||
PROGNAME, opt + index, getopt_unknown );
|
||||
|
||||
else if( (optarg == NULL) && (opt[index].has_arg == required_argument) )
|
||||
{
|
||||
/* similarly, it is an error if no argument is specified
|
||||
* with an option which requires one ...
|
||||
*/
|
||||
if( optind < argc )
|
||||
/*
|
||||
* ... except that the requirement may be satisfied from
|
||||
* the following command line argument, if any ...
|
||||
*/
|
||||
optarg = argv[*argind = optind++];
|
||||
|
||||
else
|
||||
/* so fail this case, only if no such argument exists!
|
||||
*/
|
||||
return getopt_argerror( mode, "option `%s%s' requires an argument\n",
|
||||
PROGNAME, opt + index, getopt_missing_arg( optstring ) );
|
||||
}
|
||||
|
||||
/* when the caller has provided a return buffer ...
|
||||
*/
|
||||
if( opt[index].flag != NULL )
|
||||
{
|
||||
/* ... then we place the proper return value there,
|
||||
* and return a status code of zero ...
|
||||
*/
|
||||
*(opt[index].flag) = opt[index].val;
|
||||
return 0;
|
||||
}
|
||||
/* ... otherwise, the return value becomes the status code.
|
||||
*/
|
||||
return opt[index].val;
|
||||
}
|
||||
|
||||
static
|
||||
#define getopt_std_args int argc, CHAR *const argv[], const CHAR *optstring
|
||||
int getopt_parse( int mode, getopt_std_args, ... )
|
||||
{
|
||||
/* Common core implementation for ALL `getopt' functions.
|
||||
*/
|
||||
static int argind = 0;
|
||||
static int optbase = 0;
|
||||
static const CHAR *nextchar = NULL;
|
||||
static int optmark = 0;
|
||||
|
||||
if( (optreset |= (optind < 1)) || (optind < optbase) )
|
||||
{
|
||||
/* POSIX does not prescribe any definitive mechanism for restarting
|
||||
* a `getopt' scan, but some applications may require such capability.
|
||||
* We will support it, by allowing the caller to adjust the value of
|
||||
* `optind' downwards, (nominally setting it to zero). Since POSIX
|
||||
* wants `optind' to have an initial value of one, but we want all
|
||||
* of our internal place holders to be initialised to zero, when we
|
||||
* are called for the first time, we will handle such a reset by
|
||||
* adjusting all of the internal place holders to one less than
|
||||
* the adjusted `optind' value, (but never to less than zero).
|
||||
*/
|
||||
if( optreset )
|
||||
{
|
||||
/* User has explicitly requested reinitialisation...
|
||||
* We need to reset `optind' to it's normal initial value of 1,
|
||||
* to avoid a potential infinitely recursive loop; by doing this
|
||||
* up front, we also ensure that the remaining place holders
|
||||
* will be correctly reinitialised to no less than zero.
|
||||
*/
|
||||
optind = 1;
|
||||
|
||||
/* We also need to clear the `optreset' request...
|
||||
*/
|
||||
optreset = 0;
|
||||
}
|
||||
|
||||
/* Now, we may safely reinitialise the internal place holders, to
|
||||
* one less than `optind', without fear of making them negative.
|
||||
*/
|
||||
optmark = optbase = argind = optind - 1;
|
||||
nextchar = NULL;
|
||||
}
|
||||
|
||||
/* From a POSIX perspective, the following is `undefined behaviour';
|
||||
* we implement it thus, for compatibility with GNU and BSD getopt.
|
||||
*/
|
||||
else if( optind > (argind + 1) )
|
||||
{
|
||||
/* Some applications expect to be able to manipulate `optind',
|
||||
* causing `getopt' to skip over one or more elements of `argv';
|
||||
* POSIX doesn't require us to support this brain-damaged concept;
|
||||
* (indeed, POSIX defines no particular behaviour, in the event of
|
||||
* such usage, so it must be considered a bug for an application
|
||||
* to rely on any particular outcome); nonetheless, Mac-OS-X and
|
||||
* BSD actually provide *documented* support for this capability,
|
||||
* so we ensure that our internal place holders keep track of
|
||||
* external `optind' increments; (`argind' must lag by one).
|
||||
*/
|
||||
argind = optind - 1;
|
||||
|
||||
/* When `optind' is misused, in this fashion, we also abandon any
|
||||
* residual text in the argument we had been parsing; this is done
|
||||
* without any further processing of such abandoned text, assuming
|
||||
* that the caller is equipped to handle it appropriately.
|
||||
*/
|
||||
nextchar = NULL;
|
||||
}
|
||||
|
||||
if( nextchar && *nextchar )
|
||||
{
|
||||
/* we are parsing a standard, or short format, option argument ...
|
||||
*/
|
||||
const CHAR *optchar;
|
||||
if( (optchar = getopt_match( optopt = *nextchar++, optstring )) != NULL )
|
||||
{
|
||||
/* we have identified it as valid ...
|
||||
*/
|
||||
if( optchar[1] == getopt_takes_argument )
|
||||
{
|
||||
/* and determined that it requires an associated argument ...
|
||||
*/
|
||||
if( ! *(optarg = (char *)(nextchar)) )
|
||||
{
|
||||
/* the argument is NOT attached ...
|
||||
*/
|
||||
if( optchar[2] == getopt_takes_argument )
|
||||
/*
|
||||
* but this GNU extension marks it as optional,
|
||||
* so we don't provide one on this occasion.
|
||||
*/
|
||||
optarg = NULL;
|
||||
|
||||
/* otherwise this option takes a mandatory argument,
|
||||
* so, provided there is one available ...
|
||||
*/
|
||||
else if( (argc - argind) > 1 )
|
||||
/*
|
||||
* we take the following command line argument,
|
||||
* as the appropriate option argument.
|
||||
*/
|
||||
optarg = argv[++argind];
|
||||
|
||||
/* but if no further argument is available,
|
||||
* then there is nothing we can do, except for
|
||||
* issuing the requisite diagnostic message.
|
||||
*/
|
||||
else
|
||||
{
|
||||
complain( "option requires an argument -- %c", optopt );
|
||||
return getopt_missing_arg( optstring );
|
||||
}
|
||||
}
|
||||
optind = argind + 1;
|
||||
nextchar = NULL;
|
||||
}
|
||||
else
|
||||
optarg = NULL;
|
||||
optind = (nextchar && *nextchar) ? argind : argind + 1;
|
||||
return optopt;
|
||||
}
|
||||
/* if we didn't find a valid match for the specified option character,
|
||||
* then we fall through to here, so take appropriate diagnostic action.
|
||||
*/
|
||||
if( mode == getopt_mode_long_only )
|
||||
{
|
||||
complain( "unrecognised option `-%s'", --nextchar );
|
||||
nextchar = NULL;
|
||||
optopt = 0;
|
||||
}
|
||||
else
|
||||
complain( "invalid option -- %c", optopt );
|
||||
optind = (nextchar && *nextchar) ? argind : argind + 1;
|
||||
return getopt_unknown;
|
||||
}
|
||||
|
||||
if( optmark > optbase )
|
||||
{
|
||||
/* This can happen, in GNU parsing mode ONLY, when we have
|
||||
* skipped over non-option arguments, and found a subsequent
|
||||
* option argument; in this case we permute the arguments.
|
||||
*/
|
||||
int index;
|
||||
/*
|
||||
* `optspan' specifies the number of contiguous arguments
|
||||
* which are spanned by the current option, and so must be
|
||||
* moved together during permutation.
|
||||
*/
|
||||
int optspan = argind - optmark + 1;
|
||||
/*
|
||||
* we use `this_arg' to store these temporarily.
|
||||
*/
|
||||
CHAR *this_arg[100];
|
||||
/*
|
||||
* we cannot manipulate `argv' directly, since the `getopt'
|
||||
* API prototypes it as `read-only'; this cast to `arglist'
|
||||
* allows us to work around that restriction.
|
||||
*/
|
||||
CHAR **arglist = (char **)(argv);
|
||||
|
||||
/* save temporary copies of the arguments which are associated
|
||||
* with the current option ...
|
||||
*/
|
||||
for( index = 0; index < optspan; ++index )
|
||||
this_arg[index] = arglist[optmark + index];
|
||||
|
||||
/* move all preceding non-option arguments to the right,
|
||||
* overwriting these saved arguments, while making space
|
||||
* to replace them in their permuted location.
|
||||
*/
|
||||
for( --optmark; optmark >= optbase; --optmark )
|
||||
arglist[optmark + optspan] = arglist[optmark];
|
||||
|
||||
/* restore the temporarily saved option arguments to
|
||||
* their permuted location.
|
||||
*/
|
||||
for( index = 0; index < optspan; ++index )
|
||||
arglist[optbase + index] = this_arg[index];
|
||||
|
||||
/* adjust `optbase', to account for the relocated option.
|
||||
*/
|
||||
optbase += optspan;
|
||||
}
|
||||
|
||||
else
|
||||
/* no permutation occurred ...
|
||||
* simply adjust `optbase' for all options parsed so far.
|
||||
*/
|
||||
optbase = argind + 1;
|
||||
|
||||
/* enter main parsing loop ...
|
||||
*/
|
||||
while( argc > ++argind )
|
||||
{
|
||||
/* inspect each argument in turn, identifying possible options ...
|
||||
*/
|
||||
if( is_switchar( *(nextchar = argv[optmark = argind]) ) && *++nextchar )
|
||||
{
|
||||
/* we've found a candidate option argument ... */
|
||||
|
||||
if( is_switchar( *nextchar ) )
|
||||
{
|
||||
/* it's a double hyphen argument ... */
|
||||
|
||||
const CHAR *refchar = nextchar;
|
||||
if( *++refchar )
|
||||
{
|
||||
/* and it looks like a long format option ...
|
||||
* `getopt_long' mode must be active to accept it as such,
|
||||
* `getopt_long_only' also qualifies, but we must downgrade
|
||||
* it to force explicit handling as a long format option.
|
||||
*/
|
||||
if( mode >= getopt_mode_long )
|
||||
{
|
||||
nextchar = refchar;
|
||||
mode = getopt_mode_long;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* this is an explicit `--' end of options marker, so wrap up now!
|
||||
*/
|
||||
if( optmark > optbase )
|
||||
{
|
||||
/* permuting the argument list as necessary ...
|
||||
* (note use of `this_arg' and `arglist', as above).
|
||||
*/
|
||||
CHAR *this_arg = argv[optmark];
|
||||
CHAR **arglist = (CHAR **)(argv);
|
||||
|
||||
/* move all preceding non-option arguments to the right ...
|
||||
*/
|
||||
do arglist[optmark] = arglist[optmark - 1];
|
||||
while( optmark-- > optbase );
|
||||
|
||||
/* reinstate the `--' marker, in its permuted location.
|
||||
*/
|
||||
arglist[optbase] = this_arg;
|
||||
}
|
||||
/* ... before finally bumping `optbase' past the `--' marker,
|
||||
* and returning the `all done' completion indicator.
|
||||
*/
|
||||
optind = ++optbase;
|
||||
return getopt_all_done;
|
||||
}
|
||||
}
|
||||
else if( mode < getopt_mode_long_only )
|
||||
{
|
||||
/* it's not an explicit long option, and `getopt_long_only' isn't active,
|
||||
* so we must explicitly try to match it as a short option.
|
||||
*/
|
||||
mode = getopt_mode_standard;
|
||||
}
|
||||
|
||||
if( mode >= getopt_mode_long )
|
||||
{
|
||||
/* the current argument is a long form option, (either explicitly,
|
||||
* introduced by a double hyphen, or implicitly because we were called
|
||||
* by `getopt_long_only'); this is where we parse it.
|
||||
*/
|
||||
int lookup;
|
||||
int matched = -1;
|
||||
struct option *longopts;
|
||||
int *optindex;
|
||||
/* we need to fetch the `extra' function arguments, which are
|
||||
* specified for the `getopt_long' APIs.
|
||||
*/
|
||||
va_list refptr;
|
||||
va_start( refptr, optstring );
|
||||
longopts = va_arg( refptr, struct option * );
|
||||
optindex = va_arg( refptr, int * );
|
||||
va_end( refptr );
|
||||
|
||||
/* ensuring that `optarg' does not inherit any junk, from parsing
|
||||
* preceding arguments ...
|
||||
*/
|
||||
optarg = NULL;
|
||||
for( lookup = 0; longopts && longopts[lookup].name; ++lookup )
|
||||
{
|
||||
/* scan the list of defined long form options ...
|
||||
*/
|
||||
switch( getopt_match_long( nextchar, longopts[lookup].name ) )
|
||||
{
|
||||
/* looking for possible matches for the current argument.
|
||||
*/
|
||||
case getopt_exact_match:
|
||||
/*
|
||||
* when an exact match is found,
|
||||
* return it immediately, setting `nextchar' to NULL,
|
||||
* to ensure we don't mistakenly try to match any
|
||||
* subsequent characters as short form options.
|
||||
*/
|
||||
nextchar = NULL;
|
||||
return getopt_resolved( mode, argc, argv, &argind,
|
||||
longopts, lookup, optindex, optstring );
|
||||
|
||||
case getopt_abbreviated_match:
|
||||
/*
|
||||
* but, for a partial (initial substring) match ...
|
||||
*/
|
||||
if( matched >= 0 )
|
||||
{
|
||||
/* if this is not the first, then we have an ambiguity ...
|
||||
*/
|
||||
optopt = 0;
|
||||
nextchar = NULL;
|
||||
optind = argind + 1;
|
||||
complain( "option `%s' is ambiguous", argv[argind] );
|
||||
return getopt_unknown;
|
||||
}
|
||||
/* otherwise just note that we've found a possible match ...
|
||||
*/
|
||||
matched = lookup;
|
||||
}
|
||||
}
|
||||
if( matched >= 0 )
|
||||
{
|
||||
/* if we get to here, then we found exactly one partial match,
|
||||
* so return it, as for an exact match.
|
||||
*/
|
||||
nextchar = NULL;
|
||||
return getopt_resolved( mode, argc, argv, &argind,
|
||||
longopts, matched, optindex, optstring );
|
||||
}
|
||||
if( mode < getopt_mode_long_only )
|
||||
{
|
||||
/* if here, then we had what SHOULD have been a long form option,
|
||||
* but it is unmatched; (perversely, `mode == getopt_mode_long_only'
|
||||
* allows us to still try to match it as a short form option).
|
||||
*/
|
||||
optopt = 0;
|
||||
nextchar = NULL;
|
||||
optind = argind + 1;
|
||||
complain( "unrecognised option `%s'", argv[argind] );
|
||||
return getopt_unknown;
|
||||
}
|
||||
}
|
||||
/* fall through to handle standard short form options...
|
||||
* when the option argument format is neither explictly identified
|
||||
* as long, nor implicitly matched as such, and the argument isn't
|
||||
* just a bare hyphen, (which isn't an option), then we make one
|
||||
* recursive call to explicitly interpret it as short format.
|
||||
*/
|
||||
if( *nextchar )
|
||||
return getopt_parse( mode, argc, argv, optstring );
|
||||
}
|
||||
/* if we get to here, then we've parsed a non-option argument ...
|
||||
* in GNU compatibility mode, we step over it, so we can permute
|
||||
* any subsequent option arguments, but ...
|
||||
*/
|
||||
if( *optstring == getopt_switchar )
|
||||
{
|
||||
/* if `optstring' begins with a `-' character, this special
|
||||
* GNU specific behaviour requires us to return the non-option
|
||||
* arguments in strict order, as pseudo-arguments to a special
|
||||
* option, with return value defined as `getopt_ordered'.
|
||||
*/
|
||||
nextchar = NULL;
|
||||
optind = argind + 1;
|
||||
optarg = argv[argind];
|
||||
return getopt_ordered;
|
||||
}
|
||||
if( getopt_conventions( *optstring ) & getopt_posixly_correct )
|
||||
/*
|
||||
* otherwise ...
|
||||
* for POSIXLY_CORRECT behaviour, or if `optstring' begins with
|
||||
* a `+' character, then we break out of the parsing loop, so that
|
||||
* the scan ends at the current argument, with no permutation.
|
||||
*/
|
||||
break;
|
||||
}
|
||||
/* fall through when all arguments have been evaluated,
|
||||
*/
|
||||
optind = optbase;
|
||||
return getopt_all_done;
|
||||
}
|
||||
|
||||
/* All three public API entry points are trivially defined,
|
||||
* in terms of the internal `getopt_parse' function.
|
||||
*/
|
||||
int getopt( getopt_std_args )
|
||||
{
|
||||
return getopt_parse( getopt_mode_standard, argc, argv, optstring );
|
||||
}
|
||||
|
||||
int getopt_long( getopt_std_args, const struct option *opts, int *index )
|
||||
{
|
||||
return getopt_parse( getopt_mode_long, argc, argv, optstring, opts, index );
|
||||
}
|
||||
|
||||
int getopt_long_only( getopt_std_args, const struct option *opts, int *index )
|
||||
{
|
||||
return getopt_parse( getopt_mode_long_only, argc, argv, optstring, opts, index );
|
||||
}
|
||||
|
||||
#ifdef __weak_alias
|
||||
/*
|
||||
* These Microsnot style uglified aliases are provided for compatibility
|
||||
* with the previous MinGW implementation of the getopt API.
|
||||
*/
|
||||
__weak_alias( getopt, _getopt )
|
||||
__weak_alias( getopt_long, _getopt_long )
|
||||
__weak_alias( getopt_long_only, _getopt_long_only )
|
||||
#endif
|
||||
|
||||
/* $RCSfile: getopt.c,v $Revision: 1.9 $: end of file */
|
|
@ -0,0 +1,108 @@
|
|||
#ifndef __GETOPT_H__
|
||||
/*
|
||||
* getopt.h
|
||||
*
|
||||
* $Id: getopt.h,v 1.4 2009/01/04 17:35:36 keithmarshall Exp $
|
||||
*
|
||||
* Defines constants and function prototypes required to implement
|
||||
* the `getopt', `getopt_long' and `getopt_long_only' APIs.
|
||||
*
|
||||
* This file is part of the MinGW32 package set.
|
||||
*
|
||||
* Contributed by Keith Marshall <keithmarshall@users.sourceforge.net>
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS NOT COPYRIGHTED
|
||||
*
|
||||
* This source code is offered for use in the public domain. You may
|
||||
* use, modify or distribute it freely.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful but
|
||||
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
|
||||
* DISCLAIMED. This includes but is not limited to warranties of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Revision: 1.4 $
|
||||
* $Author: keithmarshall $
|
||||
* $Date: 2009/01/04 17:35:36 $
|
||||
*
|
||||
*/
|
||||
#define __GETOPT_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern int optind; /* index of first non-option in argv */
|
||||
extern int optopt; /* single option character, as parsed */
|
||||
extern int opterr; /* flag to enable built-in diagnostics... */
|
||||
/* (user may set to zero, to suppress) */
|
||||
|
||||
extern char *optarg; /* pointer to argument of current option */
|
||||
|
||||
extern int getopt( int, char * const [], const char * );
|
||||
|
||||
#ifdef _BSD_SOURCE
|
||||
/*
|
||||
* BSD adds the non-standard `optreset' feature, for reinitialisation
|
||||
* of `getopt' parsing. We support this feature, for applications which
|
||||
* proclaim their BSD heritage, before including this header; however,
|
||||
* to maintain portability, developers are advised to avoid it.
|
||||
*/
|
||||
# define optreset __mingw_optreset
|
||||
|
||||
extern int optreset;
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
/*
|
||||
* POSIX requires the `getopt' API to be specified in `unistd.h';
|
||||
* thus, `unistd.h' includes this header. However, we do not want
|
||||
* to expose the `getopt_long' or `getopt_long_only' APIs, when
|
||||
* included in this manner. Thus, close the standard __GETOPT_H__
|
||||
* declarations block, and open an additional __GETOPT_LONG_H__
|
||||
* specific block, only when *not* __UNISTD_H_SOURCED__, in which
|
||||
* to declare the extended API.
|
||||
*/
|
||||
#endif /* !defined(__GETOPT_H__) */
|
||||
#if !defined(__UNISTD_H_SOURCED__) && !defined(__GETOPT_LONG_H__)
|
||||
#define __GETOPT_LONG_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct option /* specification for a long form option... */
|
||||
{
|
||||
const char *name; /* option name, without leading hyphens */
|
||||
int has_arg; /* does it take an argument? */
|
||||
int *flag; /* where to save its status, or NULL */
|
||||
int val; /* its associated status value */
|
||||
};
|
||||
|
||||
enum /* permitted values for its `has_arg' field... */
|
||||
{
|
||||
no_argument = 0, /* option never takes an argument */
|
||||
required_argument, /* option always requires an argument */
|
||||
optional_argument /* option may take an argument */
|
||||
};
|
||||
|
||||
extern int getopt_long( int, char * const [], const char *, const struct option *, int * );
|
||||
extern int getopt_long_only( int, char * const [], const char *, const struct option *, int * );
|
||||
/*
|
||||
* Previous MinGW implementation had...
|
||||
*/
|
||||
#ifndef HAVE_DECL_GETOPT
|
||||
/*
|
||||
* ...for the long form API only; keep this for compatibility.
|
||||
*/
|
||||
# define HAVE_DECL_GETOPT 1
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !defined(__UNISTD_H_SOURCED__) && !defined(__GETOPT_LONG_H__) */
|
||||
/* $RCSfile: getopt.h,v $Revision: 1.4 $: end of file */
|
498
linether.c~
498
linether.c~
|
@ -1,498 +0,0 @@
|
|||
/*
|
||||
Copyright 2001-2015 John Wiseman G8BPQ
|
||||
|
||||
This file is part of LinBPQ/BPQ32.
|
||||
|
||||
LinBPQ/BPQ32 is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
LinBPQ/BPQ32 is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with LinBPQ/BPQ32. If not, see http://www.gnu.org/licenses
|
||||
*/
|
||||
|
||||
//
|
||||
// DLL to provide BPQEther support for G8BPQ switch in a Linux environment,
|
||||
|
||||
// Normally uses a Raw socket, but that can't send to other apps on same machine.
|
||||
// so can use a TAP device instead (or maybe as well??)
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "CHeaders.h"
|
||||
|
||||
#include <sys/socket.h>
|
||||
#include <linux/if_packet.h>
|
||||
#include <linux/if_ether.h>
|
||||
#include <linux/if_arp.h>
|
||||
|
||||
extern char * PortConfig[33];
|
||||
|
||||
extern int tap_fd;
|
||||
|
||||
typedef struct PCAPStruct
|
||||
{
|
||||
UCHAR EthSource[6];
|
||||
UCHAR EthDest[6];
|
||||
short EtherType;
|
||||
BOOL RLITX;
|
||||
BOOL RLIRX;
|
||||
BOOL Promiscuous;
|
||||
|
||||
int s; /*socketdescriptor*/
|
||||
struct sockaddr_ll socket_address; /*target address*/
|
||||
|
||||
} PCAPINFO, *PPCAPINFO ;
|
||||
|
||||
PCAPINFO PCAPInfo[32];
|
||||
|
||||
// on linux default to broadcast
|
||||
|
||||
short udpport=0;
|
||||
|
||||
unsigned int OurInst = 0;
|
||||
|
||||
BOOL GotMsg;
|
||||
|
||||
DWORD n;
|
||||
|
||||
char Adapter[256];
|
||||
|
||||
static BOOL ReadConfigFile(int Port);
|
||||
static int ProcessLine(char * buf,int Port, BOOL CheckPort);
|
||||
int WritetoConsoleLocal(char * buff);
|
||||
|
||||
int ExtProc(int fn, int port,unsigned char * buff)
|
||||
{
|
||||
int len,txlen=0,res;
|
||||
char txbuff[500];
|
||||
unsigned char rxbuff[1600];
|
||||
PCAPINFO * IF = &PCAPInfo[port];
|
||||
|
||||
if (IF->s == 0)
|
||||
return 0;
|
||||
|
||||
switch (fn)
|
||||
{
|
||||
case 1: // poll
|
||||
|
||||
res = recvfrom(IF->s, rxbuff, ETH_FRAME_LEN, 0, NULL, NULL);
|
||||
|
||||
if (res == -1)
|
||||
{
|
||||
if (errno == 11)
|
||||
return 0; //Resource temporarily unavailable
|
||||
|
||||
perror("Eth RX");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (res == 0)
|
||||
/* Timeout elapsed */
|
||||
return 0;
|
||||
|
||||
if (rxbuff[13] != 0xff)
|
||||
return 0;
|
||||
|
||||
if (IF->RLIRX)
|
||||
|
||||
// RLI MODE - An extra 3 bytes before len, seem to be 00 00 41
|
||||
|
||||
{
|
||||
len=rxbuff[18]*256 + rxbuff[17];
|
||||
|
||||
if ((len < 16) || (len > 320)) return 0; // Probably BPQ Mode Frame
|
||||
|
||||
len-=3;
|
||||
|
||||
memcpy(&buff[7],&rxbuff[19],len);
|
||||
|
||||
len+=5;
|
||||
}
|
||||
else
|
||||
{
|
||||
len=rxbuff[15]*256 + rxbuff[14];
|
||||
|
||||
if ((len < 16) || (len > 320)) return 0; // Probably RLI Mode Frame
|
||||
|
||||
len-=3;
|
||||
|
||||
memcpy(&buff[7],&rxbuff[16],len);
|
||||
|
||||
len+=5;
|
||||
}
|
||||
|
||||
buff[5]=(len & 0xff);
|
||||
buff[6]=(len >> 8);
|
||||
|
||||
return 1;
|
||||
|
||||
|
||||
case 2: // send
|
||||
|
||||
if (IF->RLITX)
|
||||
|
||||
// RLI MODE - An extra 3 bytes before len, seem to be 00 00 41
|
||||
|
||||
{
|
||||
txlen=(buff[6]<<8) + buff[5]; // BPQEther is DOS-based - chain word is 2 bytes
|
||||
|
||||
txlen-=2;
|
||||
txbuff[16]=0x41;
|
||||
txbuff[17]=(txlen & 0xff);
|
||||
txbuff[18]=(txlen >> 8);
|
||||
|
||||
if (txlen < 1 || txlen > 400)
|
||||
return 0;
|
||||
|
||||
memcpy(&txbuff[19],&buff[7],txlen);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
txlen=(buff[6]<<8) + buff[5]; // BPQEther is DOS-based - chain word is 2 bytes
|
||||
|
||||
txlen-=2;
|
||||
|
||||
txbuff[14]=(txlen & 0xff);
|
||||
txbuff[15]=(txlen >> 8);
|
||||
|
||||
if (txlen < 1 || txlen > 400)
|
||||
return 0;
|
||||
|
||||
|
||||
memcpy(&txbuff[16],&buff[7],txlen);
|
||||
}
|
||||
|
||||
memcpy(&txbuff[0], &IF->EthDest[0],6);
|
||||
memcpy(&txbuff[6], &IF->EthSource[0],6);
|
||||
memcpy(&txbuff[12], &IF->EtherType,2);
|
||||
|
||||
txlen+=14;
|
||||
|
||||
if (txlen < 60) txlen = 60;
|
||||
|
||||
// Send down the packet
|
||||
|
||||
res = sendto(IF->s, txbuff, txlen, 0,
|
||||
(const struct sockaddr *)&IF->socket_address, sizeof(struct sockaddr_ll));
|
||||
|
||||
if (res < 0)
|
||||
{
|
||||
perror("Eth Send");
|
||||
return 3;
|
||||
}
|
||||
|
||||
// if (tap_fd)
|
||||
// write(tap_fd, txbuff, txlen);
|
||||
|
||||
return (0);
|
||||
|
||||
case 3: // CHECK IF OK TO SEND
|
||||
|
||||
return (0); // OK
|
||||
|
||||
case 4: // reinit
|
||||
|
||||
return 0;
|
||||
|
||||
case 5: // reinit
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
UINT ETHERExtInit(struct PORTCONTROL * PortEntry)
|
||||
{
|
||||
// Can have multiple ports, each mapping to a different Ethernet Adapter
|
||||
|
||||
// The Adapter number is in IOADDR
|
||||
//
|
||||
|
||||
int i=0;
|
||||
u_int netmask;
|
||||
char buf[256];
|
||||
int n;
|
||||
struct ifreq ifr;
|
||||
size_t if_name_len;
|
||||
PCAPINFO * IF;
|
||||
int port = PortEntry->PORTNUMBER;
|
||||
u_long param=1;
|
||||
struct ifreq buffer;
|
||||
|
||||
WritetoConsoleLocal("BPQEther ");
|
||||
|
||||
//
|
||||
// Read config
|
||||
//
|
||||
|
||||
if (!ReadConfigFile(port))
|
||||
return (FALSE);
|
||||
|
||||
if_name_len = strlen(Adapter);
|
||||
|
||||
IF = &PCAPInfo[port];
|
||||
|
||||
IF->s = socket(AF_PACKET, SOCK_RAW, htons(ETH_P_BPQ));
|
||||
|
||||
if (IF->s == -1)
|
||||
{
|
||||
perror("Open Ether Socket");
|
||||
IF->s = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
ioctl(IF->s, FIONBIO, ¶m);
|
||||
memcpy(ifr.ifr_name, Adapter, if_name_len);
|
||||
ifr.ifr_name[if_name_len] = 0;
|
||||
|
||||
if (ioctl(IF->s, SIOCGIFINDEX,&ifr) == -1)
|
||||
perror("Get IF Number");
|
||||
|
||||
// Get MAC Address
|
||||
|
||||
memset(&buffer, 0x00, sizeof(buffer));
|
||||
|
||||
strcpy(buffer.ifr_name, Adapter);
|
||||
ioctl(IF->s, SIOCGIFHWADDR, &buffer);
|
||||
memcpy(IF->EthSource, buffer.ifr_hwaddr.sa_data, 6);
|
||||
}
|
||||
|
||||
n=sprintf(buf,"Using %s = Interface %d\n", Adapter, ifr.ifr_ifindex);
|
||||
WritetoConsoleLocal(buf);
|
||||
|
||||
/*prepare sockaddr_ll*/
|
||||
|
||||
/*RAW communication*/
|
||||
IF->socket_address.sll_family = PF_PACKET;
|
||||
|
||||
/*we don't use a protocoll above ethernet layer ->just use anything here*/
|
||||
IF->socket_address.sll_protocol = htons(ETH_P_IP);
|
||||
|
||||
//index of the network device
|
||||
|
||||
IF->socket_address.sll_ifindex = ifr.ifr_ifindex;
|
||||
|
||||
/*ARP hardware identifier is ethernet*/
|
||||
IF->socket_address.sll_hatype = ARPHRD_ETHER;
|
||||
|
||||
/*target is another host*/
|
||||
IF->socket_address.sll_pkttype = PACKET_BROADCAST;
|
||||
|
||||
/*address length*/
|
||||
IF->socket_address.sll_halen = ETH_ALEN;
|
||||
/*MAC - begin*/
|
||||
|
||||
memcpy(IF->socket_address.sll_addr, IF->EthDest, 6);
|
||||
IF->socket_address.sll_addr[6] = 0x00;/*not used*/
|
||||
IF->socket_address.sll_addr[7] = 0x00;/*not used*/
|
||||
|
||||
|
||||
// n=sprintf(buf,"Using %s Adapter = Interface %d\r", ifr.ifr_ifindex);
|
||||
// WritetoConsole(buf);
|
||||
|
||||
return ((int) ExtProc);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static BOOL ReadConfigFile(int Port)
|
||||
{
|
||||
//TYPE 1 08FF # Ethernet Type
|
||||
//ETH 1 FF:FF:FF:FF:FF:FF # Target Ethernet AddrMAP G8BPQ-7 10.2.77.1 # IP 93 for compatibility
|
||||
//ADAPTER 1 \Device\NPF_{21B601E8-8088-4F7D-96 29-EDE2A9243CF4} # Adapter Name
|
||||
|
||||
char buf[256],errbuf[256];
|
||||
char * Config;
|
||||
|
||||
Config = PortConfig[Port];
|
||||
|
||||
PCAPInfo[Port].Promiscuous = 1; // Default
|
||||
PCAPInfo[Port].EtherType=htons(0x08FF); // Default
|
||||
memset(PCAPInfo[Port].EthDest, 0xff, 6);
|
||||
|
||||
|
||||
if (Config)
|
||||
{
|
||||
// Using config from bpq32.cfg
|
||||
|
||||
char * ptr1 = Config, * ptr2;
|
||||
|
||||
ptr2 = strchr(ptr1, 13);
|
||||
while(ptr2)
|
||||
{
|
||||
memcpy(buf, ptr1, ptr2 - ptr1);
|
||||
buf[ptr2 - ptr1] = 0;
|
||||
ptr1 = ptr2 + 2;
|
||||
ptr2 = strchr(ptr1, 13);
|
||||
|
||||
strcpy(errbuf,buf); // save in case of error
|
||||
|
||||
if (!ProcessLine(buf, Port, FALSE))
|
||||
{
|
||||
WritetoConsoleLocal("BPQEther - Bad config record ");
|
||||
WritetoConsoleLocal(errbuf);
|
||||
WritetoConsoleLocal("\n");
|
||||
}
|
||||
}
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
n=sprintf(buf,"No config info found in bpq32.cfg\n");
|
||||
WritetoConsoleLocal(buf);
|
||||
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
|
||||
static int ProcessLine(char * buf, int Port, BOOL CheckPort)
|
||||
{
|
||||
char * ptr;
|
||||
char * p_port;
|
||||
char * p_mac;
|
||||
char * p_Adapter;
|
||||
char * p_type;
|
||||
|
||||
int port;
|
||||
int a,b,c,d,e,f,num;
|
||||
|
||||
ptr = strtok(buf, " \t\n\r");
|
||||
|
||||
if(ptr == NULL) return (TRUE);
|
||||
|
||||
if(*ptr =='#') return (TRUE); // comment
|
||||
|
||||
if(*ptr ==';') return (TRUE); // comment
|
||||
|
||||
if (CheckPort)
|
||||
{
|
||||
p_port = strtok(NULL, " \t\n\r");
|
||||
|
||||
if (p_port == NULL) return (FALSE);
|
||||
|
||||
port = atoi(p_port);
|
||||
|
||||
if (Port != port) return TRUE; // Not for us
|
||||
}
|
||||
|
||||
if(_stricmp(ptr,"ADAPTER") == 0)
|
||||
{
|
||||
p_Adapter = strtok(NULL, " \t\n\r");
|
||||
|
||||
strcpy(Adapter,p_Adapter);
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
if(_stricmp(ptr,"TYPE") == 0)
|
||||
{
|
||||
p_type = strtok(NULL, " \t\n\r");
|
||||
|
||||
if (p_type == NULL) return (FALSE);
|
||||
|
||||
num=sscanf(p_type,"%x",&a);
|
||||
|
||||
if (num != 1) return FALSE;
|
||||
|
||||
PCAPInfo[Port].EtherType=htons(a);
|
||||
return (TRUE);
|
||||
|
||||
}
|
||||
|
||||
if(_stricmp(ptr,"promiscuous") == 0)
|
||||
{
|
||||
ptr = strtok(NULL, " \t\n\r");
|
||||
|
||||
if (ptr == NULL) return (FALSE);
|
||||
|
||||
PCAPInfo[Port].Promiscuous = atoi(ptr);
|
||||
|
||||
return (TRUE);
|
||||
|
||||
}
|
||||
|
||||
if(_stricmp(ptr,"RXMODE") == 0)
|
||||
{
|
||||
p_port = strtok(NULL, " \t\n\r");
|
||||
|
||||
if (p_port == NULL) return (FALSE);
|
||||
|
||||
if(_stricmp(p_port,"RLI") == 0)
|
||||
{
|
||||
PCAPInfo[Port].RLIRX=TRUE;
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
if(_stricmp(p_port,"BPQ") == 0)
|
||||
{
|
||||
PCAPInfo[Port].RLIRX=FALSE;
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
||||
}
|
||||
|
||||
if(_stricmp(ptr,"TXMODE") == 0)
|
||||
{
|
||||
p_port = strtok(NULL, " \t\n\r");
|
||||
|
||||
if (p_port == NULL) return (FALSE);
|
||||
|
||||
if(_stricmp(p_port,"RLI") == 0)
|
||||
{
|
||||
PCAPInfo[Port].RLITX=TRUE;
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
if(_stricmp(p_port,"BPQ") == 0)
|
||||
{
|
||||
PCAPInfo[Port].RLITX=FALSE;
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
||||
}
|
||||
|
||||
if(_stricmp(ptr,"DEST") == 0)
|
||||
{
|
||||
p_mac = strtok(NULL, " \t\n\r");
|
||||
|
||||
if (p_mac == NULL) return (FALSE);
|
||||
|
||||
num=sscanf(p_mac,"%x-%x-%x-%x-%x-%x",&a,&b,&c,&d,&e,&f);
|
||||
|
||||
if (num != 6) return FALSE;
|
||||
|
||||
PCAPInfo[Port].EthDest[0]=a;
|
||||
PCAPInfo[Port].EthDest[1]=b;
|
||||
PCAPInfo[Port].EthDest[2]=c;
|
||||
PCAPInfo[Port].EthDest[3]=d;
|
||||
PCAPInfo[Port].EthDest[4]=e;
|
||||
PCAPInfo[Port].EthDest[5]=f;
|
||||
|
||||
|
||||
// strcpy(Adapter,p_Adapter);
|
||||
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
if(_stricmp(ptr,"SOURCE") == 0) // not used, but ignore
|
||||
return (TRUE);
|
||||
|
||||
//
|
||||
// Bad line
|
||||
//
|
||||
return (FALSE);
|
||||
|
||||
}
|
||||
|
10
rigcontrol.h
10
rigcontrol.h
|
@ -74,9 +74,10 @@ struct RIGINFO
|
|||
int ICF8101; // ICOM Land Mobile IC-F8101
|
||||
char * CM108Device; // Device to open for CM108 GPIO PTT
|
||||
|
||||
struct _EXTPORTDATA * PortRecord[32]; // BPQ32 port record(s) for this rig (null terminated list)
|
||||
struct _EXTPORTDATA * PortRecord[64]; // BPQ32 port record(s) for this rig (null terminated list)
|
||||
|
||||
UCHAR RigAddr;
|
||||
int Channel; // For sdrangel
|
||||
uint64_t ScanStopped; // Scanning enabled if zero. Bits used for interlocked scanning (eg winmor/pactor on same port
|
||||
int ScanCounter;
|
||||
int PollCounter; // Don't poll too often;
|
||||
|
@ -198,6 +199,9 @@ struct RIGINFO
|
|||
#define RTLUDP 16
|
||||
#define FLRIG 17
|
||||
#define SDRRADIO 18
|
||||
//G7TAJ
|
||||
#define SDRANGEL 19
|
||||
//G7TAJ
|
||||
|
||||
// Yease seem to have lots of variants of the same model
|
||||
|
||||
|
@ -234,7 +238,9 @@ struct RIGPORTINFO
|
|||
HANDLE hPTTDevice; // May use a different port for PTT
|
||||
UCHAR TXBuffer[500]; // Last message sent - saved for Retry
|
||||
int TXLen; // Len of last sent
|
||||
UCHAR RXBuffer[500]; // Message being received - may not arrive all at once
|
||||
// ---- G7TAJ ----
|
||||
UCHAR RXBuffer[8192]; // Message being received - may not arrive all at once. SDRANGLE needs a lot
|
||||
// ---- G7TAJ ----
|
||||
int RXLen; // Data in RXBUffer
|
||||
BOOL AutoPoll; // set if last command was a Timer poll
|
||||
// Local ScanStruct for Interactive Commands
|
||||
|
|
|
@ -420,6 +420,7 @@ char * MainConfigtxt()
|
|||
"<style type=\"text/css\">"
|
||||
"input.btn:active {background:black;color:white;} "
|
||||
"submit.btn:active {background:black;color:white;} "
|
||||
"table, th, td {border: 1px solid black;border-collapse: collapse;}"
|
||||
"</style>"
|
||||
"<script type=\"text/javascript\"> \r\n"
|
||||
" \r\n"
|
||||
|
@ -454,7 +455,7 @@ char * MainConfigtxt()
|
|||
"<br>\r\n"
|
||||
"<div style=\"text-align: center;\"><font size=\"+1\"><span style=\"font-family: monospace; font-weight: bold;\">Main Configuration</span></font></div>\r\n"
|
||||
"\r\n"
|
||||
"<div id=\"main\" style=\"border: 2px solid ; overflow: auto; position: relative; top: 10px; height: 980px; width: 740px; left: 86px;\">\r\n"
|
||||
"<div id=\"main\" style=\"border: 2px solid ; overflow: auto; position: relative; top: 10px; height: 1180px; width: 740px; left: 86px;\">\r\n"
|
||||
"<form border=\"1\" style=\"font-family: monospace;\" method=\"post\" action=\"/Mail/Config?%s\">\r\n"
|
||||
" <h3> BBS Params</h3>\r\n"
|
||||
" BBS Call <input value=\"%s\" name=\"BBSCall\"> SYSOP\r\n"
|
||||
|
@ -510,8 +511,13 @@ char * MainConfigtxt()
|
|||
"<textarea cols=\"8\" rows=\"5\" name=\"Hto\">%s</textarea> \r\n"
|
||||
"<textarea cols=\"8\" rows=\"5\" name=\"Hat\">%s</textarea>\r\n"
|
||||
"<textarea cols=\"8\" rows=\"5\" name=\"HBID\">%s</textarea>\r\n"
|
||||
"\r\n"
|
||||
"<div style=\"position: absolute; left: 290px; top: 950px;\"><input class='btn' name=\"Save\" value=\"Save\" type=submit class='btn'> <input class='btn' name=\"Cancel\" value=\"Cancel\" type=submit class='btn'></div>\r\n"
|
||||
"<p></p>"
|
||||
" FBB reject.sys type filters (all fields must match, wildcards allowed)\r\n"
|
||||
"<p></p>"
|
||||
"<div style='position: absolute; left: 20px;height: 120px; overflow:auto;'>%s</div>"
|
||||
"<div style='position: absolute; top: 1100px;left: 300px; overflow:auto;'>"
|
||||
"<input class='btn' name=\"Save\" value=\"Save\" type=submit class='btn'> <input class='btn' name=\"Cancel\" value=\"Cancel\" type=submit class='btn'>"
|
||||
"</div>"
|
||||
"</form>\r\n"
|
||||
"</div>\r\n";
|
||||
|
||||
|
@ -1438,8 +1444,10 @@ char * ChatConfigtxt()
|
|||
|
||||
"<br><br>The Callsign of the Chat Node is not defined here - it is obtained from the bpq32.cfg APPLICATION line corresponding to the Chat Appl Number.<br>\r\n"
|
||||
"<br></div>\n"
|
||||
"Nodes to link to<br>"
|
||||
" <textarea cols=\"70\" rows=\"5\" name=\"nodes\">%s</textarea><br>\r\n"
|
||||
"<br>\r\n"
|
||||
"<span style=\"font-family: monospace;\"></span>Node to Node Link PACLEN \r\n"
|
||||
" <input value=\"%d\" size=\"3\" name=\"Paclen\"><br><br>\r\n"
|
||||
" Map Position <input onchange=CheckLen() maxlength=\"80\" value=\"%s\" size=\"20\" name=\"Posn\" id=pos> <br>\r\n"
|
||||
"<br>\r\n"
|
||||
" Popup Type Hover <input %s name=\"PopType\" value=\"Hover\"\r\n"
|
||||
|
@ -1452,7 +1460,7 @@ char * ChatConfigtxt()
|
|||
"<textarea cols=\"80\" rows=\"5\" name=\"welcome\">%s</textarea><br>\r\n"
|
||||
"<br>\r\n"
|
||||
"\r\n"
|
||||
"<div style=\"position: absolute; left: 150px; top: 550px;\">\r\n"
|
||||
"<div style=\"position: absolute; left: 150px; top: 600px;\">\r\n"
|
||||
"<input name=\"Save\" value=\"Save\" type=submit class='btn'> \r\n"
|
||||
"<input name=\"UpdateMap\" value=\"Update Map\" type=submit class='btn'> \r\n"
|
||||
"<input name=\"Restart\" value=\"Restart Links\" type=submit class='btn'> \r\n"
|
||||
|
|
Loading…
Reference in New Issue