6.0.23.66

This commit is contained in:
g8bpq 2023-05-16 16:40:12 +01:00
parent 60ff21fb31
commit ac7e6b99be
42 changed files with 1454 additions and 399 deletions

View File

@ -731,7 +731,7 @@ VOID AEAPoll(int Port)
sprintf(Msg, "%d SCANSTOP", TNC->Port); sprintf(Msg, "%d SCANSTOP", TNC->Port);
Rig_Command(-1, Msg); Rig_Command( (TRANSPORTENTRY *) -1, Msg);
// Shouldn't we also take out of standby mode?? PN is Pactor Listen, for monitoring // Shouldn't we also take out of standby mode?? PN is Pactor Listen, for monitoring
@ -795,7 +795,7 @@ VOID AEAPoll(int Port)
sprintf(Status, "%d SCANSTART 15", TNC->Port); sprintf(Status, "%d SCANSTART 15", TNC->Port);
Rig_Command(-1, Status); Rig_Command( (TRANSPORTENTRY *) -1, Status);
return; return;
} }
@ -910,7 +910,7 @@ VOID AEAPoll(int Port)
if ((Stream == 0) && memcmp(MsgPtr, "RADIO ", 6) == 0) if ((Stream == 0) && memcmp(MsgPtr, "RADIO ", 6) == 0)
{ {
sprintf(&MsgPtr[40], "%d %s", TNC->Port, &MsgPtr[6]); sprintf(&MsgPtr[40], "%d %s", TNC->Port, &MsgPtr[6]);
if (Rig_Command(TNC->PortRecord->ATTACHEDSESSIONS[0]->L4CROSSLINK->CIRCUITINDEX, &MsgPtr[40])) if (Rig_Command(TNC->PortRecord->ATTACHEDSESSIONS[0]->L4CROSSLINK, &MsgPtr[40]))
{ {
ReleaseBuffer(buffptr); ReleaseBuffer(buffptr);
} }
@ -1434,7 +1434,7 @@ static VOID ProcessAEAPacket(struct TNCINFO * TNC, UCHAR * Msg, size_t Len)
sprintf(Msg, "%d SCANSTOP", TNC->Port); sprintf(Msg, "%d SCANSTOP", TNC->Port);
Rig_Command(-1, Msg); Rig_Command( (TRANSPORTENTRY *) -1, Msg);
ShowTraffic(TNC); ShowTraffic(TNC);

View File

@ -4386,6 +4386,7 @@ Lost:
} }
} }
int GPSDAlerted = 0;
static VOID GPSDConnect(void * unused) static VOID GPSDConnect(void * unused)
{ {
@ -4427,6 +4428,7 @@ static VOID GPSDConnect(void * unused)
#else #else
Debugprintf("GPSD Connected"); Debugprintf("GPSD Connected");
#endif #endif
GPSDAlerted = 0;
ioctl(TCPSock, FIONBIO, &param); ioctl(TCPSock, FIONBIO, &param);
// Request data // Request data
@ -4436,11 +4438,13 @@ static VOID GPSDConnect(void * unused)
else else
{ {
err=WSAGetLastError(); err=WSAGetLastError();
if (GPSDAlerted == 0)
#ifdef LINBPQ #ifdef LINBPQ
printf("GPSD Connect Failed - error code = %d\n", err); printf("GPSD Connect Failed - error code = %d\n", err);
#else #else
Debugprintf("GPSD Connect Failed - error code = %d", err); Debugprintf("GPSD Connect Failed - error code = %d", err);
#endif #endif
GPSDAlerted = 1;
closesocket(TCPSock); closesocket(TCPSock);
GPSDOK = FALSE; GPSDOK = FALSE;

12
ARDOP.c
View File

@ -1216,7 +1216,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
sprintf(Msg, "%d SCANSTOP", TNC->Port); sprintf(Msg, "%d SCANSTOP", TNC->Port);
Rig_Command(-1, Msg); Rig_Command( (TRANSPORTENTRY *) -1, Msg);
} }
else else
{ {
@ -1468,7 +1468,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
{ {
sprintf(&buff->L2DATA[0], "%d %s", TNC->Port, &buff->L2DATA[6]); sprintf(&buff->L2DATA[0], "%d %s", TNC->Port, &buff->L2DATA[6]);
if (Rig_Command(TNC->PortRecord->ATTACHEDSESSIONS[0]->L4CROSSLINK->CIRCUITINDEX, &buff->L2DATA[0])) if (Rig_Command(TNC->PortRecord->ATTACHEDSESSIONS[0]->L4CROSSLINK, &buff->L2DATA[0]))
{ {
} }
else else
@ -1863,11 +1863,11 @@ VOID ARDOPReleaseTNC(struct TNCINFO * TNC)
if (TNC->DefaultRadioCmd) if (TNC->DefaultRadioCmd)
{ {
sprintf(TXMsg, "%d %s", TNC->Port, TNC->DefaultRadioCmd); sprintf(TXMsg, "%d %s", TNC->Port, TNC->DefaultRadioCmd);
Rig_Command(-1, TXMsg); Rig_Command( (TRANSPORTENTRY *) -1, TXMsg);
} }
sprintf(TXMsg, "%d SCANSTART 15", TNC->Port); sprintf(TXMsg, "%d SCANSTART 15", TNC->Port);
Rig_Command(-1, TXMsg); Rig_Command( (TRANSPORTENTRY *) -1, TXMsg);
ReleaseOtherPorts(TNC); ReleaseOtherPorts(TNC);
@ -3116,7 +3116,7 @@ VOID ARDOPProcessResponse(struct TNCINFO * TNC, UCHAR * Buffer, int MsgLen)
TidyClose(TNC, 0); TidyClose(TNC, 0);
sprintf(Status, "%d SCANSTART 15", TNC->Port); sprintf(Status, "%d SCANSTART 15", TNC->Port);
Rig_Command(-1, Status); Rig_Command( (TRANSPORTENTRY *) -1, Status);
Debugprintf("ARDOP Call from %s rejected", Call); Debugprintf("ARDOP Call from %s rejected", Call);
return; return;
} }
@ -3141,7 +3141,7 @@ VOID ARDOPProcessResponse(struct TNCINFO * TNC, UCHAR * Buffer, int MsgLen)
TidyClose(TNC, 0); TidyClose(TNC, 0);
sprintf(Status, "%d SCANSTART 15", TNC->Port); sprintf(Status, "%d SCANSTART 15", TNC->Port);
Rig_Command(-1, Status); Rig_Command( (TRANSPORTENTRY *) -1, Status);
Debugprintf("ARDOP Call from %s not in ValidCalls - rejected", Call); Debugprintf("ARDOP Call from %s not in ValidCalls - rejected", Call);
return; return;
} }

View File

@ -122,7 +122,7 @@ int decode_quoted_printable(char *ptr, int len);
void decodeblock( unsigned char in[4], unsigned char out[3]); void decodeblock( unsigned char in[4], unsigned char out[3]);
int encode_quoted_printable(char *s, char * out, int Len); int encode_quoted_printable(char *s, char * out, int Len);
int32_t Encode(char * in, char * out, int32_t inlen, BOOL B1Protocol, int Compress); int32_t Encode(char * in, char * out, int32_t inlen, BOOL B1Protocol, int Compress);
int APIENTRY ChangeSessionCallsign(int Stream, unsigned char * AXCall);
config_t cfg; config_t cfg;
config_setting_t * group; config_setting_t * group;
@ -7890,6 +7890,31 @@ BOOL ConnecttoBBS (struct UserInfo * user)
ConnectUsingAppl(conn->BPQStream, BBSApplMask); ConnectUsingAppl(conn->BPQStream, BBSApplMask);
FreeSemaphore(&ConSemaphore); FreeSemaphore(&ConSemaphore);
// If we are sending to a dump pms we may need to connect using the message sender's callsign.
// But we wont know until we run the connect script, which is a bit late to change call. Could add
// flag to forwarding config, but easier to look for SETCALLTOSENDER in the connect script.
if (strstr(ForwardingInfo->ConnectScript[0], "SETCALLTOSENDER"))
{
conn->SendB = conn->SendP = conn->SendT = conn->DoReverse = TRUE;
conn->MaxBLen = conn->MaxPLen = conn->MaxTLen = 99999999;
if (FindMessagestoForward(conn) && conn->FwdMsg)
{
// We have a message to send
struct MsgInfo * Msg;
unsigned char AXCall[7];
Msg = conn->FwdMsg;
ConvToAX25(Msg->from, AXCall);
ChangeSessionCallsign(p, AXCall);
conn->BBSFlags |= TEXTFORWARDING | SETCALLTOSENDER | NEWPACCOM;
conn->NextMessagetoForward = 0; // was set by FindMessages
}
conn->SendB = conn->SendP = conn->SendT = conn->DoReverse = FALSE;
}
#ifdef LINBPQ #ifdef LINBPQ
{ {
BPQVECSTRUC * SESS; BPQVECSTRUC * SESS;
@ -8136,7 +8161,7 @@ InBand:
char * Cmd; char * Cmd;
if (strcmp(Buffer, "*** CONNECTED TO SYNC ") != 0) if (strstr(Buffer, "*** CONNECTED TO SYNC"))
{ {
char * IPAddr = &Buffer[22]; char * IPAddr = &Buffer[22];
char * Port = strlop(IPAddr, ':'); char * Port = strlop(IPAddr, ':');
@ -8287,6 +8312,12 @@ InBand:
goto CheckForEnd; goto CheckForEnd;
} }
if (_memicmp(Cmd, "SETCALLTOSENDER", 15) == 0)
{
conn->BBSFlags |= TEXTFORWARDING | SETCALLTOSENDER;
goto CheckForEnd;
}
if (_memicmp(Cmd, "RADIOONLY", 9) == 0) if (_memicmp(Cmd, "RADIOONLY", 9) == 0)
{ {
conn->BBSFlags |= WINLINKRO; conn->BBSFlags |= WINLINKRO;
@ -8626,6 +8657,10 @@ CheckForSID:
Msg = conn->FwdMsg; Msg = conn->FwdMsg;
if ((conn->BBSFlags & SETCALLTOSENDER))
nodeprintf(conn, "S%c %s @ %s \r", Msg->type, Msg->to,
(Msg->via[0]) ? Msg->via : conn->UserPointer->Call);
else
nodeprintf(conn, "S%c %s @ %s < %s $%s\r", Msg->type, Msg->to, nodeprintf(conn, "S%c %s @ %s < %s $%s\r", Msg->type, Msg->to,
(Msg->via[0]) ? Msg->via : conn->UserPointer->Call, (Msg->via[0]) ? Msg->via : conn->UserPointer->Call,
Msg->from, Msg->bid); Msg->from, Msg->bid);
@ -8834,6 +8869,12 @@ VOID Parse_SID(CIRCUIT * conn, char * SID, int len)
conn->OpenBCM = TRUE; conn->OpenBCM = TRUE;
} }
if (_memicmp(SID, "PMS-3.2", 7) == 0)
{
// Paccom TNC that doesn't send newline prompt ater receiving subject
conn->BBSFlags |= NEWPACCOM;
}
// See if BPQ for selective forwarding // See if BPQ for selective forwarding
@ -11262,8 +11303,12 @@ VOID ProcessTextFwdLine(ConnectionInfo * conn, struct UserInfo * user, char * Bu
Buffer[len] = 0; Buffer[len] = 0;
// Debugprintf(Buffer); // Debugprintf(Buffer);
if (len == 1 && Buffer[0] == 13) // With TNC2 body prompt is a single CR, so that shouldn't be ignored.
return;
// If thia causes problems with other TNC PMS implementations I'll have to revisit this
// if (len == 1 && Buffer[0] == 13)
// return;
if (conn->Flags & SENDTITLE) if (conn->Flags & SENDTITLE)
{ {
@ -11275,6 +11320,9 @@ VOID ProcessTextFwdLine(ConnectionInfo * conn, struct UserInfo * user, char * Bu
conn->Flags &= ~SENDTITLE; conn->Flags &= ~SENDTITLE;
conn->Flags |= SENDBODY; conn->Flags |= SENDBODY;
// New Paccom PMS (V3.2) doesn't prompt for body so drop through and send it
if ((conn->BBSFlags & NEWPACCOM) == 0)
return; return;
} }
@ -11391,11 +11439,32 @@ VOID ProcessTextFwdLine(ConnectionInfo * conn, struct UserInfo * user, char * Bu
{ {
struct MsgInfo * Msg; struct MsgInfo * Msg;
// If we are using SETCALLTOSENDER make sure this message is from the same sender
#ifdef LINBPQ
BPQVECSTRUC * SESS = &BPQHOSTVECTOR[0];
#else
BPQVECSTRUC * SESS = (BPQVECSTRUC *)BPQHOSTVECPTR;
#endif
unsigned char AXCall[7];
Msg = conn->FwdMsg;
ConvToAX25(Msg->from, AXCall);
if (memcmp(SESS[conn->BPQStream - 1].HOSTSESSION->L4USER, AXCall, 7) != 0)
{
Disconnect(conn->BPQStream);
return;
}
// Send S line and wait for response - SB WANT @ USA < W8AAA $1029_N0XYZ // Send S line and wait for response - SB WANT @ USA < W8AAA $1029_N0XYZ
conn->Flags |= SENDTITLE; conn->Flags |= SENDTITLE;
Msg = conn->FwdMsg;
if ((conn->BBSFlags & SETCALLTOSENDER))
nodeprintf(conn, "S%c %s @ %s \r", Msg->type, Msg->to,
(Msg->via[0]) ? Msg->via : conn->UserPointer->Call);
else
nodeprintf(conn, "S%c %s @ %s < %s $%s\r", Msg->type, Msg->to, nodeprintf(conn, "S%c %s @ %s < %s $%s\r", Msg->type, Msg->to,
(Msg->via[0]) ? Msg->via : conn->UserPointer->Call, (Msg->via[0]) ? Msg->via : conn->UserPointer->Call,
Msg->from, Msg->bid); Msg->from, Msg->bid);

View File

@ -1110,6 +1110,9 @@
// Fix Webmail auto-refresh when page exceeds 64K bytes (54) // Fix Webmail auto-refresh when page exceeds 64K bytes (54)
// Fix Webmail send when using both headers/footers and attachmonts (55) // Fix Webmail send when using both headers/footers and attachmonts (55)
// Fix R: line corruption on some 64 bit builds // Fix R: line corruption on some 64 bit builds
// Dont drop empty lines inm TEXTFORWARDING (61)
// Dont wait for body prompt for TEXTFORWARDING for SID [PMS-3.2-C$] (62)
// Add forwarding mode SETCALLTOSENDER for PMS Systems that don't accept < in SP (63)
#include "bpqmail.h" #include "bpqmail.h"
#define MAIL #define MAIL

12
Bpq32.c
View File

@ -1153,8 +1153,14 @@ along with LinBPQ/BPQ32. If not, see http://www.gnu.org/licenses
// Fix TNC Emulator Monitoring (53) // Fix TNC Emulator Monitoring (53)
// Fix attach and connect on Telnet port bug introduced in .55 (56) // Fix attach and connect on Telnet port bug introduced in .55 (56)
// Fix stopping WinRPR TNC and Start/Stop UZ7HO TNCX on Linux (57) // Fix stopping WinRPR TNC and Start/Stop UZ7HO TNCX on Linux (57)
// Fix stack size in beginthread for MAC // Fix stack size in beginthread for MAC (58)
// Add NETROM over VARA (60)
// Add Disconnect Script (64)
// Add node commands to set UZ7HO modem mode and freq (64)
// Trap empty NODECALL or NETROMCALL(65)
// Trap NODES messages with empty From Call (65)
// Add RigControl for SDRConsole (66)
// Fix FLRig crash (66)
#define CKernel #define CKernel
@ -6605,5 +6611,3 @@ char * stristr (char *ch1, char *ch2)
return chRet; return chRet;
} }

View File

@ -346,6 +346,8 @@ char * ReadInfoFile(char * File)
// First remove cr from crlf // First remove cr from crlf
ptr1 = MsgBytes;
while(ptr2 = strstr(ptr1, "\r\n")) while(ptr2 = strstr(ptr1, "\r\n"))
{ {
memmove(ptr2, ptr2 + 1, strlen(ptr2)); memmove(ptr2, ptr2 + 1, strlen(ptr2));

91
Cmd.c
View File

@ -170,6 +170,8 @@ void ListExcludedCalls(TRANSPORTENTRY * Session, char * Bufferptr, char * CmdTai
VOID APRSCMD(TRANSPORTENTRY * Session, char * Bufferptr, char * CmdTail, CMDX * CMD); VOID APRSCMD(TRANSPORTENTRY * Session, char * Bufferptr, char * CmdTail, CMDX * CMD);
VOID RECONFIGTELNET (TRANSPORTENTRY * Session, char * Bufferptr, char * CmdTail, CMDX * CMD); VOID RECONFIGTELNET (TRANSPORTENTRY * Session, char * Bufferptr, char * CmdTail, CMDX * CMD);
VOID HELPCMD(TRANSPORTENTRY * Session, char * Bufferptr, char * CmdTail, CMDX * CMD); VOID HELPCMD(TRANSPORTENTRY * Session, char * Bufferptr, char * CmdTail, CMDX * CMD);
VOID UZ7HOCMD(TRANSPORTENTRY * Session, char * Bufferptr, char * CmdTail, CMDX * UserCMD);
@ -3662,13 +3664,13 @@ VOID MHCMD(TRANSPORTENTRY * Session, char * Bufferptr, char * CmdTail, CMDX * CM
SendCommandReply(Session, REPLYBUFFER, (int)(Bufferptr - (char *)REPLYBUFFER)); SendCommandReply(Session, REPLYBUFFER, (int)(Bufferptr - (char *)REPLYBUFFER));
} }
int Rig_Command(int Session, char * Command); int Rig_Command(TRANSPORTENTRY * Session, char * Command);
VOID RADIOCMD(TRANSPORTENTRY * Session, char * Bufferptr, char * CmdTail, CMDX * UserCMD) VOID RADIOCMD(TRANSPORTENTRY * Session, char * Bufferptr, char * CmdTail, CMDX * UserCMD)
{ {
char * ptr; char * ptr;
if (Rig_Command(Session->CIRCUITINDEX, CmdTail)) if (Rig_Command(Session, CmdTail))
{ {
ReleaseBuffer((UINT *)REPLYBUFFER); ReleaseBuffer((UINT *)REPLYBUFFER);
return; return;
@ -4071,7 +4073,7 @@ checkattachandcall:
char Msg[128]; char Msg[128];
sprintf(Msg, "R%d %f", TNC->RXRadio, TNC->ActiveRXFreq); sprintf(Msg, "R%d %f", TNC->RXRadio, TNC->ActiveRXFreq);
Rig_Command(-1, Msg); Rig_Command( (TRANSPORTENTRY *) -1, Msg);
} }
if (TNC && TNC->ActiveTXFreq && TNC->TXRadio && TNC->TXRadio != TNC->RXRadio) if (TNC && TNC->ActiveTXFreq && TNC->TXRadio && TNC->TXRadio != TNC->RXRadio)
@ -4079,7 +4081,7 @@ checkattachandcall:
char Msg[128]; char Msg[128];
sprintf(Msg, "R%d %f", TNC->TXRadio, TNC->ActiveTXFreq); sprintf(Msg, "R%d %f", TNC->TXRadio, TNC->ActiveTXFreq);
Rig_Command(-1, Msg); Rig_Command( (TRANSPORTENTRY *) -1, Msg);
} }
if (ptr) if (ptr)
@ -4261,6 +4263,8 @@ CMDX COMMANDS[] =
"ARP ",3,SHOWARP,0, "ARP ",3,SHOWARP,0,
"NAT ",3,SHOWNAT,0, "NAT ",3,SHOWNAT,0,
"IPROUTE ",3,SHOWIPROUTE,0, "IPROUTE ",3,SHOWIPROUTE,0,
"UZ7HO ",5,UZ7HOCMD,0,
"..FLMSG ",7,FLMSG,0 "..FLMSG ",7,FLMSG,0
}; };
@ -4508,6 +4512,10 @@ VOID InnerCommandHandler(TRANSPORTENTRY * Session, struct DATAMESSAGE * Buffer)
if (Session->UNPROTO) if (Session->UNPROTO)
{ {
// char LongMsg[512] =
// "VeryLongMessageVeryLongMessageVeryLongMessageVeryLongMessageVeryLongMessageVeryLongMessageVeryLongMessageVeryLongMessageVeryLongMessageVeryLongMessage"
// "VeryLongMessageVeryLongMessageVeryLongMessageVeryLongMessageVeryLongMessageVeryLongMessageVeryLongMessageVeryLongMessageVeryLongMessageVeryLongMessage";
DIGIMESSAGE Msg; DIGIMESSAGE Msg;
int Port = Session->UNPROTO; int Port = Session->UNPROTO;
int Len = Buffer->LENGTH - (MSGHDDRLEN -1); // Need PID int Len = Buffer->LENGTH - (MSGHDDRLEN -1); // Need PID
@ -4540,9 +4548,12 @@ VOID InnerCommandHandler(TRANSPORTENTRY * Session, struct DATAMESSAGE * Buffer)
memcpy(Msg.ORIGIN, Session->L4USER, 7); memcpy(Msg.ORIGIN, Session->L4USER, 7);
memcpy(Msg.DIGIS, &Session->UADDRESS[7], Session->UAddrLen - 7); memcpy(Msg.DIGIS, &Session->UADDRESS[7], Session->UAddrLen - 7);
memcpy(&Msg.PID, &Buffer->PID, Len); memcpy(&Msg.PID, &Buffer->PID, Len);
Send_AX_Datagram(&Msg, Len, Port); // Len is Payload - CTL, PID and Data Send_AX_Datagram(&Msg, Len, Port); // Len is Payload - CTL, PID and Data
// memcpy(&Msg.PID + 1, LongMsg, 260);
// Send_AX_Datagram(&Msg, 241, Port); // Len is Payload - CTL, PID and Data
// SendUIModeFrame(Session, (PMESSAGE)Buffer, Session->UNPROTO); // SendUIModeFrame(Session, (PMESSAGE)Buffer, Session->UNPROTO);
ReleaseBuffer((UINT *)Buffer); // Not using buffer for reply ReleaseBuffer((UINT *)Buffer); // Not using buffer for reply
@ -5614,6 +5625,76 @@ VOID HELPCMD(TRANSPORTENTRY * Session, char * Bufferptr, char * CmdTail, CMDX *
SendCommandReply(Session, REPLYBUFFER, (int)(Bufferptr - (char *)REPLYBUFFER)); SendCommandReply(Session, REPLYBUFFER, (int)(Bufferptr - (char *)REPLYBUFFER));
} }
int UZ7HOSetFreq(int port, struct TNCINFO * TNC, struct AGWINFO * AGW, PDATAMESSAGE buff, PMSGWITHLEN buffptr);
int UZ7HOSetModem(int port, struct TNCINFO * TNC, struct AGWINFO * AGW, PDATAMESSAGE buff, PMSGWITHLEN buffptr);
VOID UZ7HOCMD(TRANSPORTENTRY * Session, char * Bufferptr, char * CmdTail, CMDX * CMD)
{
char * Cmd;
int port;
struct TNCINFO * TNC;
struct AGWINFO * AGW = 0;
PDATAMESSAGE buff;
PMSGWITHLEN buffptr;
Cmd = strlop(CmdTail, ' ');
port = atoi(CmdTail);
// remove trailing spaces
while(strlen(Cmd) && Cmd[strlen(Cmd) - 1] == ' ')
Cmd[strlen(Cmd) - 1] = 0;
TNC = TNCInfo[port];
if (TNC)
AGW = TNC->AGWInfo;
if (TNC == 0 || AGW == 0)
{
Bufferptr = Cmdprintf(Session, Bufferptr, "Error - %d is not UZ7HO port\r", port);
SendCommandReply(Session, REPLYBUFFER, (int)(Bufferptr - (char *)REPLYBUFFER));
return;
}
if (_memicmp(Cmd, "FREQ", 4) == 0 || _memicmp(Cmd, "MODEM", 5) == 0)
{
// Pass to procesing code in UZ7HO driver. This expects command in a PDATAMESSAGE amd places response in a PMSGWITHLEN buffer
buff = (PDATAMESSAGE)GetBuff();
buffptr = (PMSGWITHLEN)GetBuff();
if (buffptr == 0)
{
Bufferptr = Cmdprintf(Session, Bufferptr, "UZ7HO Command Failed - no buffers\r");
if (buff)
ReleaseBuffer(buff);
SendCommandReply(Session, REPLYBUFFER, (int)(Bufferptr - (char *)REPLYBUFFER));
return;
}
buff->LENGTH = sprintf(buff->L2DATA, "%s\r", Cmd) + MSGHDDRLEN + 1;
if (_memicmp(Cmd, "FREQ", 4) == 0)
UZ7HOSetFreq(port, TNC, AGW, buff, buffptr);
else
UZ7HOSetModem(port, TNC, AGW, buff, buffptr);
Bufferptr = Cmdprintf(Session, Bufferptr, buffptr->Data);
ReleaseBuffer(buff);
ReleaseBuffer(buffptr);
}
else
Bufferptr = Cmdprintf(Session, Bufferptr, "Invalid UZ7HO Command (not Freq Mode Modem)\r");
SendCommandReply(Session, REPLYBUFFER, (int)(Bufferptr - (char *)REPLYBUFFER));
return;
}

View File

@ -72,6 +72,7 @@ extern BOOL LogAllConnects;
extern VOID * ENDBUFFERPOOL; extern VOID * ENDBUFFERPOOL;
// Read/Write length field in a buffer header // Read/Write length field in a buffer header
// Needed for Big/LittleEndian and ARM5 (unaligned operation problem) portability // Needed for Big/LittleEndian and ARM5 (unaligned operation problem) portability
@ -777,7 +778,7 @@ NotConnected:
char Msg[128]; char Msg[128];
sprintf(Msg, "R%d %f", TNC->RXRadio, TNC->DefaultRXFreq); sprintf(Msg, "R%d %f", TNC->RXRadio, TNC->DefaultRXFreq);
Rig_Command(-1, Msg); Rig_Command( (TRANSPORTENTRY *) -1, Msg);
} }
if (TNC->DefaultTXFreq && TNC->TXRadio && TNC->TXRadio != TNC->RXRadio) if (TNC->DefaultTXFreq && TNC->TXRadio && TNC->TXRadio != TNC->RXRadio)
@ -785,7 +786,7 @@ NotConnected:
char Msg[128]; char Msg[128];
sprintf(Msg, "R%d %f", TNC->TXRadio, TNC->DefaultTXFreq); sprintf(Msg, "R%d %f", TNC->TXRadio, TNC->DefaultTXFreq);
Rig_Command(-1, Msg); Rig_Command( (TRANSPORTENTRY *) -1, Msg);
} }
while(STREAM->BPQtoPACTOR_Q) while(STREAM->BPQtoPACTOR_Q)
@ -927,7 +928,7 @@ BOOL ProcessIncommingConnectEx(struct TNCINFO * TNC, char * Call, int Stream, BO
sprintf(Msg, "%d SCANSTOP", TNC->Port); sprintf(Msg, "%d SCANSTOP", TNC->Port);
Rig_Command(-1, Msg); Rig_Command( (TRANSPORTENTRY *) -1, Msg);
UpdateMH(TNC, Call, '+', 'I'); UpdateMH(TNC, Call, '+', 'I');
} }

View File

@ -200,7 +200,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
// Stop Scanning // Stop Scanning
sprintf(Cmd, "%d SCANSTOP", TNC->Port); sprintf(Cmd, "%d SCANSTOP", TNC->Port);
Rig_Command(-1, Cmd); Rig_Command( (TRANSPORTENTRY *) -1, Cmd);
sprintf(TNC->WEB_TNCSTATE, "In Use by %s", TNC->Streams[0].MyCall); sprintf(TNC->WEB_TNCSTATE, "In Use by %s", TNC->Streams[0].MyCall);
SetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE); SetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
@ -536,7 +536,7 @@ pollloop:
{ {
sprintf(&buff->L2DATA[0], "%d %s", TNC->Port, &buff->L2DATA[6]); sprintf(&buff->L2DATA[0], "%d %s", TNC->Port, &buff->L2DATA[6]);
if (Rig_Command(TNC->PortRecord->ATTACHEDSESSIONS[0]->L4CROSSLINK->CIRCUITINDEX, &buff->L2DATA[0])) if (Rig_Command(TNC->PortRecord->ATTACHEDSESSIONS[0]->L4CROSSLINK, &buff->L2DATA[0]))
{ {
} }
else else
@ -3214,7 +3214,7 @@ VOID FLReleaseTNC(struct TNCINFO * TNC)
sprintf(TXMsg, "%d SCANSTART 15", TNC->Port); sprintf(TXMsg, "%d SCANSTART 15", TNC->Port);
Rig_Command(-1, TXMsg); Rig_Command( (TRANSPORTENTRY *) -1, TXMsg);
ReleaseOtherPorts(TNC); ReleaseOtherPorts(TNC);

View File

@ -614,7 +614,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
sprintf(Msg, "%d SCANSTOP", TNC->Port); sprintf(Msg, "%d SCANSTOP", TNC->Port);
Rig_Command(-1, Msg); Rig_Command( (TRANSPORTENTRY *) -1, Msg);
} }
if (STREAM->Attached) if (STREAM->Attached)
@ -774,7 +774,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
{ {
sprintf(&buff->L2DATA[0], "%d %s", TNC->Port, &buff->L2DATA[6]); sprintf(&buff->L2DATA[0], "%d %s", TNC->Port, &buff->L2DATA[6]);
if (Rig_Command(TNC->PortRecord->ATTACHEDSESSIONS[0]->L4CROSSLINK->CIRCUITINDEX, &buff->L2DATA[0])) if (Rig_Command(TNC->PortRecord->ATTACHEDSESSIONS[0]->L4CROSSLINK, &buff->L2DATA[0]))
{ {
} }
else else
@ -1095,7 +1095,7 @@ VOID FreeDataReleaseTNC(struct TNCINFO * TNC)
sprintf(TXMsg, "%d SCANSTART 15", TNC->Port); sprintf(TXMsg, "%d SCANSTART 15", TNC->Port);
Rig_Command(-1, TXMsg); Rig_Command( (TRANSPORTENTRY *) -1, TXMsg);
FreeDataReleasePort(TNC); FreeDataReleasePort(TNC);
ReleaseOtherPorts(TNC); ReleaseOtherPorts(TNC);

View File

@ -765,7 +765,7 @@ VOID HALPoll(int Port)
sprintf(Msg, "%d SCANSTOP", TNC->Port); sprintf(Msg, "%d SCANSTOP", TNC->Port);
Rig_Command(-1, Msg); Rig_Command( (TRANSPORTENTRY *) -1, Msg);
SendCmd(TNC, "\x42", 1); // Connect Enable off SendCmd(TNC, "\x42", 1); // Connect Enable off
@ -820,7 +820,7 @@ VOID HALPoll(int Port)
sprintf(Status, "%d SCANSTART 15", TNC->Port); sprintf(Status, "%d SCANSTART 15", TNC->Port);
Rig_Command(-1, Status); Rig_Command( (TRANSPORTENTRY *) -1, Status);
return; return;
} }
@ -894,7 +894,7 @@ VOID HALPoll(int Port)
if (memcmp(MsgPtr, "RADIO ", 6) == 0) if (memcmp(MsgPtr, "RADIO ", 6) == 0)
{ {
sprintf(&MsgPtr[40], "%d %s", TNC->Port, &MsgPtr[6]); sprintf(&MsgPtr[40], "%d %s", TNC->Port, &MsgPtr[6]);
if (Rig_Command(TNC->PortRecord->ATTACHEDSESSIONS[0]->L4CROSSLINK->CIRCUITINDEX, &MsgPtr[40])) if (Rig_Command(TNC->PortRecord->ATTACHEDSESSIONS[0]->L4CROSSLINK, &MsgPtr[40]))
{ {
ReleaseBuffer(buffptr); ReleaseBuffer(buffptr);
} }
@ -1764,7 +1764,7 @@ BOOL HALConnected(struct TNCINFO * TNC, char * Call)
sprintf(Msg, "%d SCANSTOP", TNC->Port); sprintf(Msg, "%d SCANSTOP", TNC->Port);
Rig_Command(-1, Msg); Rig_Command( (TRANSPORTENTRY *) -1, Msg);
ShowTraffic(TNC); ShowTraffic(TNC);

View File

@ -67,6 +67,7 @@ BOOL ToLOC(double Lat, double Lon , char * Locator);
int GetPosnFromAPRS(char * Call, double * Lat, double * Lon); int GetPosnFromAPRS(char * Call, double * Lat, double * Lon);
char * stristr (char *ch1, char *ch2); char * stristr (char *ch1, char *ch2);
static RECT Rect; static RECT Rect;
extern struct TNCINFO * TNCInfo[41]; // Records are Malloc'd extern struct TNCINFO * TNCInfo[41]; // Records are Malloc'd
@ -1834,6 +1835,42 @@ BOOL UpdateWL2KSYSOPInfo(char * Call, char * SQL)
// Process config lines that are common to a number of HF modes // Process config lines that are common to a number of HF modes
static char ** SeparateMultiString(char * MultiString)
{
char ** Value;
int Count = 0;
char * ptr, * ptr1;
// Convert to string array
Value = zalloc(sizeof(void *)); // always NULL entry on end even if no values
Value[0] = NULL;
strlop(MultiString, 13);
ptr = MultiString;
while (ptr && strlen(ptr))
{
ptr1 = strchr(ptr, '|');
if (ptr1)
*(ptr1++) = 0;
if (strlen(ptr))
{
Value = realloc(Value, (Count+2) * sizeof(void *));
Value[Count++] = _strdup(ptr);
}
ptr = ptr1;
}
Value[Count] = NULL;
return Value;
}
extern int nextDummyInterlock; extern int nextDummyInterlock;
int standardParams(struct TNCINFO * TNC, char * buf) int standardParams(struct TNCINFO * TNC, char * buf)
@ -1855,6 +1892,8 @@ int standardParams(struct TNCINFO * TNC, char * buf)
TNC->LISTENCALLS = _strdup(&buf[8]); TNC->LISTENCALLS = _strdup(&buf[8]);
strlop(TNC->LISTENCALLS, '\r'); strlop(TNC->LISTENCALLS, '\r');
} }
else if (_memicmp(buf, "NRNEIGHBOUR", 11) == 0)
TNC->NRNeighbour = _strdup(&buf[12]);
else if (_memicmp(buf, "MAXCONREQ", 9) == 0) // Hold Time for Busy Detect else if (_memicmp(buf, "MAXCONREQ", 9) == 0) // Hold Time for Busy Detect
TNC->MaxConReq = atoi(&buf[9]); TNC->MaxConReq = atoi(&buf[9]);
@ -1878,6 +1917,8 @@ int standardParams(struct TNCINFO * TNC, char * buf)
TNC->ActiveTXFreq = atof(&buf[13]); TNC->ActiveTXFreq = atof(&buf[13]);
else if (_memicmp(buf, "ActiveRXFreq", 12) == 0) // Set at start of session else if (_memicmp(buf, "ActiveRXFreq", 12) == 0) // Set at start of session
TNC->ActiveRXFreq = atof(&buf[13]); TNC->ActiveRXFreq = atof(&buf[13]);
else if (_memicmp(buf, "DisconnectScript", 16) == 0) // Set at start of session
TNC->DisconnectScript = SeparateMultiString(&buf[17]);
else if (_memicmp(buf, "PTTONHEX", 8) == 0) else if (_memicmp(buf, "PTTONHEX", 8) == 0)
{ {
// Hex String to use for PTT on for this port // Hex String to use for PTT on for this port

View File

@ -567,7 +567,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
sprintf(Msg, "%d SCANSTOP", TNC->Port); sprintf(Msg, "%d SCANSTOP", TNC->Port);
Rig_Command(-1, Msg); Rig_Command( (TRANSPORTENTRY *) -1, Msg);
} }
if (STREAM->Attached) if (STREAM->Attached)
@ -685,7 +685,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
{ {
sprintf(&buff->L2DATA[0], "%d %s", TNC->Port, &buff->L2DATA[6]); sprintf(&buff->L2DATA[0], "%d %s", TNC->Port, &buff->L2DATA[6]);
if (Rig_Command(TNC->PortRecord->ATTACHEDSESSIONS[0]->L4CROSSLINK->CIRCUITINDEX, &buff->L2DATA[0])) if (Rig_Command(TNC->PortRecord->ATTACHEDSESSIONS[0]->L4CROSSLINK, &buff->L2DATA[0]))
{ {
} }
else else
@ -890,7 +890,7 @@ VOID HSMODEMReleaseTNC(struct TNCINFO * TNC)
sprintf(TXMsg, "%d SCANSTART 15", TNC->Port); sprintf(TXMsg, "%d SCANSTART 15", TNC->Port);
Rig_Command(-1, TXMsg); Rig_Command( (TRANSPORTENTRY *) -1, TXMsg);
ReleaseOtherPorts(TNC); ReleaseOtherPorts(TNC);

View File

@ -775,7 +775,7 @@ VOID ProcessChatLine(ChatCIRCUIT * conn, struct UserInfo * user, char* OrigBuffe
return; return;
} }
if (_memicmp(&Buffer[1], "History", cmdLen) == 0) if (cmdLen > 1 && _memicmp(&Buffer[1], "History", cmdLen) == 0) // Accept Hi but not H
{ {
// Param is number of minutes to go back (max 24 hours) // Param is number of minutes to go back (max 24 hours)

View File

@ -900,7 +900,7 @@ VOID KAMPoll(int Port)
sprintf(Msg, "%d SCANSTOP", TNC->Port); sprintf(Msg, "%d SCANSTOP", TNC->Port);
Rig_Command(-1, Msg); Rig_Command( (TRANSPORTENTRY *) -1, Msg);
} }
} }
@ -1051,7 +1051,7 @@ VOID KAMPoll(int Port)
sprintf(Status, "%d SCANSTART 15", TNC->Port); sprintf(Status, "%d SCANSTART 15", TNC->Port);
Rig_Command(-1, Status); Rig_Command( (TRANSPORTENTRY *) -1, Status);
return; return;
} }
@ -1189,7 +1189,7 @@ VOID KAMPoll(int Port)
if ((Stream == 0) && memcmp(MsgPtr, "RADIO ", 6) == 0) if ((Stream == 0) && memcmp(MsgPtr, "RADIO ", 6) == 0)
{ {
sprintf(&MsgPtr[40], "%d %s", TNC->Port, &MsgPtr[6]); sprintf(&MsgPtr[40], "%d %s", TNC->Port, &MsgPtr[6]);
if (Rig_Command(TNC->PortRecord->ATTACHEDSESSIONS[0]->L4CROSSLINK->CIRCUITINDEX, &MsgPtr[40])) if (Rig_Command(TNC->PortRecord->ATTACHEDSESSIONS[0]->L4CROSSLINK, &MsgPtr[40]))
{ {
ReleaseBuffer(buffptr); ReleaseBuffer(buffptr);
} }
@ -1770,7 +1770,7 @@ VOID ProcessKHOSTPacket(struct TNCINFO * TNC, UCHAR * Msg, int Len)
sprintf(Msg, "%d SCANSTOP", TNC->Port); sprintf(Msg, "%d SCANSTOP", TNC->Port);
Rig_Command(-1, Msg); Rig_Command( (TRANSPORTENTRY *) -1, Msg);
sprintf(TNC->WEB_TRAFFIC, "RX %d TX %d ACKED %d ", sprintf(TNC->WEB_TRAFFIC, "RX %d TX %d ACKED %d ",
TNC->Streams[0].BytesRXed, TNC->Streams[0].BytesTXed, TNC->Streams[0].BytesAcked); TNC->Streams[0].BytesRXed, TNC->Streams[0].BytesTXed, TNC->Streams[0].BytesAcked);

View File

@ -346,7 +346,7 @@ ok:
sprintf(Msg, "%d SCANSTOP", TNC->Port); sprintf(Msg, "%d SCANSTOP", TNC->Port);
Rig_Command(-1, Msg); Rig_Command( (TRANSPORTENTRY *) -1, Msg);
} }
if (STREAM->Attached) if (STREAM->Attached)
@ -460,7 +460,7 @@ ok:
{ {
sprintf(&buff->L2DATA[0], "%d %s", TNC->Port, &txbuff[6]); sprintf(&buff->L2DATA[0], "%d %s", TNC->Port, &txbuff[6]);
if (Rig_Command(TNC->PortRecord->ATTACHEDSESSIONS[0]->L4CROSSLINK->CIRCUITINDEX, &buff->L2DATA[0])) if (Rig_Command(TNC->PortRecord->ATTACHEDSESSIONS[0]->L4CROSSLINK, &buff->L2DATA[0]))
{ {
} }
else else
@ -717,7 +717,7 @@ VOID KISSHFReleaseTNC(struct TNCINFO * TNC)
// Start Scanner // Start Scanner
sprintf(TXMsg, "%d SCANSTART 15", TNC->Port); sprintf(TXMsg, "%d SCANSTART 15", TNC->Port);
Rig_Command(-1, TXMsg); Rig_Command( (TRANSPORTENTRY *) -1, TXMsg);
strcpy(TNC->WEB_TNCSTATE, "Free"); strcpy(TNC->WEB_TNCSTATE, "Free");
MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE); MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);

View File

@ -50,6 +50,7 @@ along with LinBPQ/BPQ32. If not, see http://www.gnu.org/licenses
#include <fcntl.h> #include <fcntl.h>
#include "CHeaders.h" #include "CHeaders.h"
#include "tncinfo.h"
VOID UPDATEDESTLIST(); VOID UPDATEDESTLIST();
VOID MOVEALL(dest_list * DEST); VOID MOVEALL(dest_list * DEST);
@ -57,11 +58,15 @@ VOID MOVE3TO2(dest_list * DEST);
VOID CLEARTHIRD(dest_list * DEST); VOID CLEARTHIRD(dest_list * DEST);
VOID L3TRYNEXTDEST(struct ROUTE * ROUTE); VOID L3TRYNEXTDEST(struct ROUTE * ROUTE);
VOID SendNETROMRoute(struct PORTCONTROL * PORT, unsigned char * axcall); VOID SendNETROMRoute(struct PORTCONTROL * PORT, unsigned char * axcall);
void SendVARANetromNodes(struct TNCINFO * TNC, MESSAGE *Buffer);
void SendVARANetromMsg(struct TNCINFO * TNC,L3MESSAGEBUFFER * Buffer);
extern BOOL NODESINPROGRESS ;; extern BOOL NODESINPROGRESS ;;
PPORTCONTROL L3CURRENTPORT; PPORTCONTROL L3CURRENTPORT;
extern dest_list * CURRENTNODE; extern dest_list * CURRENTNODE;
extern struct TNCINFO * TNCInfo[41];
int L3_10SECS = 10; int L3_10SECS = 10;
@ -73,6 +78,7 @@ VOID L3BG()
struct DEST_LIST * DEST = DESTS; // NODE LIST struct DEST_LIST * DEST = DESTS; // NODE LIST
struct PORTCONTROL * PORT = PORTTABLE; struct PORTCONTROL * PORT = PORTTABLE;
struct ROUTE * ROUTE; struct ROUTE * ROUTE;
struct TNCINFO * TNC;
struct _LINKTABLE * LINK; struct _LINKTABLE * LINK;
@ -87,6 +93,20 @@ VOID L3BG()
if (ActiveRoute) if (ActiveRoute)
{ {
ROUTE = DEST->NRROUTE[ActiveRoute - 1].ROUT_NEIGHBOUR; ROUTE = DEST->NRROUTE[ActiveRoute - 1].ROUT_NEIGHBOUR;
// if NetROM over VARA pass direct to the driver
if (ROUTE)
{
TNC = TNCInfo[ROUTE->NEIGHBOUR_PORT];
if (TNC && TNC->NetRomMode)
{
PL3MESSAGEBUFFER MSG = (PL3MESSAGEBUFFER)Q_REM(&DEST->DEST_Q);
SendVARANetromMsg(TNC, MSG);
return;
}
}
if (ROUTE) if (ROUTE)
LINK = ROUTE->NEIGHBOUR_LINK; LINK = ROUTE->NEIGHBOUR_LINK;
else else
@ -138,6 +158,7 @@ BOOL ACTIVATE_DEST(struct DEST_LIST * DEST)
struct PORTCONTROL * PORT = PORTTABLE; struct PORTCONTROL * PORT = PORTTABLE;
struct ROUTE * ROUTE; struct ROUTE * ROUTE;
struct _LINKTABLE * LINK; struct _LINKTABLE * LINK;
struct TNCINFO * TNC;
int ActiveRoute; int ActiveRoute;
@ -165,6 +186,15 @@ BOOL ACTIVATE_DEST(struct DEST_LIST * DEST)
ROUTE = DEST->ROUTE[0].ROUT_NEIGHBOUR; ROUTE = DEST->ROUTE[0].ROUT_NEIGHBOUR;
} }
// if NetROM over VARA conection is made by the driver
TNC = TNCInfo[ROUTE->NEIGHBOUR_PORT];
if (TNC && TNC->NetRomMode)
{
return TRUE;
}
LINK = ROUTE->NEIGHBOUR_LINK; LINK = ROUTE->NEIGHBOUR_LINK;
if (LINK == 0) if (LINK == 0)
@ -236,6 +266,12 @@ VOID PROCESSNODEMESSAGE(MESSAGE * Msg, struct PORTCONTROL * PORT)
} }
Msg->ORIGIN[6] &= 0x1E; // MASK OFF LAST ADDR BIT Msg->ORIGIN[6] &= 0x1E; // MASK OFF LAST ADDR BIT
// Trap Empty Call
if (Msg->ORIGIN[0] == 0x40)
return;
/* /*
// validate call ptr = &Buffer->ORIGIN[0]; // validate call ptr = &Buffer->ORIGIN[0];
n = 6; n = 6;
@ -726,8 +762,9 @@ VOID SENDNEXTNODESFRAGMENT()
fragmentCount = 0; fragmentCount = 0;
while (PORT->PORTQUALITY == 0 || PORT->TXPORT || PORT->INP3ONLY)
// Don't send NODES to Shared TX or INP3 Port // Don't send NODES to Shared TX or INP3 Port
while (PORT->PORTQUALITY == 0 || PORT->TXPORT || PORT->INP3ONLY)
{ {
// No NODES to this port, so go to next // No NODES to this port, so go to next
@ -808,7 +845,7 @@ VOID SENDNEXTNODESFRAGMENT()
goto Sendit; goto Sendit;
} }
if (DEST->NRROUTE[0].ROUT_QUALITY >= TXMINQUAL && if (DEST->DEST_CALL[0] != 0x40 && DEST->NRROUTE[0].ROUT_QUALITY >= TXMINQUAL &&
DEST->NRROUTE[0].ROUT_OBSCOUNT >= OBSMIN && DEST->NRROUTE[0].ROUT_OBSCOUNT >= OBSMIN &&
(NODE == 1 || DEST->DEST_STATE & 0x80)) // Only send appl nodes if DEST = 0; (NODE == 1 || DEST->DEST_STATE & 0x80)) // Only send appl nodes if DEST = 0;
{ {
@ -856,7 +893,11 @@ Sendit:
if (Buffer->LENGTH > 35 || fragmentCount == 0) // Always send first even if no other nodes if (Buffer->LENGTH > 35 || fragmentCount == 0) // Always send first even if no other nodes
{ {
if (PORT->TNC && PORT->TNC->Hardware == H_VARA)
SendVARANetromNodes(PORT->TNC, Buffer);
else
PUT_ON_PORT_Q(PORT, Buffer); PUT_ON_PORT_Q(PORT, Buffer);
fragmentCount++; fragmentCount++;
} }
else else
@ -1020,10 +1061,15 @@ VOID L3FastTimer()
// ID MESSAGE SEQUENCE // ID MESSAGE SEQUENCE
MESSAGE * Msg; MESSAGE * Msg;
struct PORTCONTROL * PORT ; struct PORTCONTROL * PORT = PORTTABLE;
INP3TIMER(); INP3TIMER();
// Send Node faster if VARA
if (NODESINPROGRESS && L3CURRENTPORT->TNC && L3CURRENTPORT->TNC->NetRomMode)
SENDNEXTNODESFRAGMENT();
L3_10SECS--; L3_10SECS--;
if (L3_10SECS == 0) if (L3_10SECS == 0)

View File

@ -32,6 +32,7 @@ along with LinBPQ/BPQ32. If not, see http://www.gnu.org/licenses
#include <fcntl.h> #include <fcntl.h>
#include "CHeaders.h" #include "CHeaders.h"
#include "tncinfo.h"
extern BPQVECSTRUC BPQHOSTVECTOR[]; extern BPQVECSTRUC BPQHOSTVECTOR[];
#define BPQHOSTSTREAMS 64 #define BPQHOSTSTREAMS 64
@ -65,6 +66,7 @@ VOID ProcessINP3RIF(struct ROUTE * Route, UCHAR * ptr1, int msglen, int Port);
VOID ProcessRTTMsg(struct ROUTE * Route, struct _L3MESSAGEBUFFER * Buff, int Len, int Port); VOID ProcessRTTMsg(struct ROUTE * Route, struct _L3MESSAGEBUFFER * Buff, int Len, int Port);
VOID FRAMEFORUS(struct _LINKTABLE * LINK, L3MESSAGEBUFFER * L3MSG, int ApplMask, UCHAR * ApplCall); VOID FRAMEFORUS(struct _LINKTABLE * LINK, L3MESSAGEBUFFER * L3MSG, int ApplMask, UCHAR * ApplCall);
void WriteConnectLog(char * fromCall, char * toCall, UCHAR * Mode); void WriteConnectLog(char * fromCall, char * toCall, UCHAR * Mode);
void SendVARANetromMsg(struct TNCINFO * TNC, PL3MESSAGEBUFFER MSG);
extern UINT APPLMASK; extern UINT APPLMASK;
@ -440,7 +442,7 @@ VOID SENDL4CONNECT(TRANSPORTENTRY * Session)
if (DEST->DEST_CALL[0] == 0) if (DEST->DEST_CALL[0] == 0)
{ {
Debugprintf("Trying to send L4CREEQ to NULL Destination"); Debugprintf("Trying to send L4CREQ to NULL Destination");
ReleaseBuffer(MSG); ReleaseBuffer(MSG);
return; return;
} }
@ -593,7 +595,7 @@ VOID L4BG()
{ {
SENDL4MESSAGE(L4, Msg); SENDL4MESSAGE(L4, Msg);
ReleaseBuffer(Msg); ReleaseBuffer(Msg);
break; continue;
} }
LINK = L4->L4TARGET.LINK; LINK = L4->L4TARGET.LINK;
@ -1387,6 +1389,8 @@ VOID SendConACK(struct _LINKTABLE * LINK, TRANSPORTENTRY * L4, L3MESSAGEBUFFER *
{ {
// SEND CONNECT ACK // SEND CONNECT ACK
struct TNCINFO * TNC;
L4CONNECTSIN++; L4CONNECTSIN++;
L3MSG->L4TXNO = L4->CIRCUITINDEX; L3MSG->L4TXNO = L4->CIRCUITINDEX;
@ -1457,6 +1461,11 @@ VOID SendConACK(struct _LINKTABLE * LINK, TRANSPORTENTRY * L4, L3MESSAGEBUFFER *
L3MSG->LENGTH++; L3MSG->LENGTH++;
} }
TNC = LINK->LINKPORT->TNC;
if (TNC && TNC->NetRomMode)
SendVARANetromMsg(TNC, L3MSG);
else
C_Q_ADD(&LINK->TX_Q, L3MSG); C_Q_ADD(&LINK->TX_Q, L3MSG);
} }
@ -1697,6 +1706,7 @@ VOID FRAMEFORUS(struct _LINKTABLE * LINK, L3MESSAGEBUFFER * L3MSG, int ApplMask,
L3MESSAGEBUFFER * Saved; L3MESSAGEBUFFER * Saved;
L3MESSAGEBUFFER ** Prev; L3MESSAGEBUFFER ** Prev;
char Call[10]; char Call[10];
struct TNCINFO * TNC;
L4FRAMESRX++; L4FRAMESRX++;
@ -1838,6 +1848,11 @@ VOID FRAMEFORUS(struct _LINKTABLE * LINK, L3MESSAGEBUFFER * L3MSG, int ApplMask,
L3SWAPADDRESSES(L3MSG); // EXCHANGE SOURCE AND DEST L3SWAPADDRESSES(L3MSG); // EXCHANGE SOURCE AND DEST
L3MSG->L3TTL = L3LIVES; L3MSG->L3TTL = L3LIVES;
TNC = LINK->LINKPORT->TNC;
if (TNC && TNC->NetRomMode)
SendVARANetromMsg(TNC, L3MSG);
else
C_Q_ADD(&LINK->TX_Q, L3MSG); C_Q_ADD(&LINK->TX_Q, L3MSG);
CloseSessionPartner(L4); // SEND CLOSE TO PARTNER (IF PRESENT) CloseSessionPartner(L4); // SEND CLOSE TO PARTNER (IF PRESENT)

View File

@ -187,7 +187,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
// Stop Scanning // Stop Scanning
sprintf(Cmd, "%d SCANSTOP", TNC->Port); sprintf(Cmd, "%d SCANSTOP", TNC->Port);
Rig_Command(-1, Cmd); Rig_Command( (TRANSPORTENTRY *) -1, Cmd);
len = sprintf(Cmd, "%cSTOP_BEACON_ARQ_FAE\x1b", '\x1a'); len = sprintf(Cmd, "%cSTOP_BEACON_ARQ_FAE\x1b", '\x1a');
@ -415,7 +415,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
{ {
sprintf(buff->L2DATA, "%d %s", TNC->Port, &buff->L2DATA[6]); sprintf(buff->L2DATA, "%d %s", TNC->Port, &buff->L2DATA[6]);
if (Rig_Command(TNC->PortRecord->ATTACHEDSESSIONS[0]->L4CROSSLINK->CIRCUITINDEX, buff->L2DATA)) if (Rig_Command(TNC->PortRecord->ATTACHEDSESSIONS[0]->L4CROSSLINK, buff->L2DATA))
{ {
} }
else else
@ -1537,7 +1537,7 @@ VOID CloseComplete(struct TNCINFO * TNC, int Stream)
int Len; int Len;
sprintf(Cmd, "%d SCANSTART 15", TNC->Port); sprintf(Cmd, "%d SCANSTART 15", TNC->Port);
Rig_Command(-1, Cmd); Rig_Command( (TRANSPORTENTRY *) -1, Cmd);
Cmd[0] = 0; Cmd[0] = 0;

View File

@ -10,7 +10,7 @@
> >
<DebugSettings <DebugSettings
Command="$(TargetPath)" Command="$(TargetPath)"
WorkingDirectory="" WorkingDirectory="C:\linbpq"
CommandArguments="" CommandArguments=""
Attach="false" Attach="false"
DebuggerType="3" DebuggerType="3"
@ -22,7 +22,7 @@
SQLDebugging="" SQLDebugging=""
Environment="" Environment=""
EnvironmentMerge="true" EnvironmentMerge="true"
DebuggerFlavor="" DebuggerFlavor="0"
MPIRunCommand="" MPIRunCommand=""
MPIRunArguments="" MPIRunArguments=""
MPIRunWorkingDirectory="" MPIRunWorkingDirectory=""

View File

@ -177,7 +177,7 @@ KC6OAR*>ID:
Port &= 0x7F; Port &= 0x7F;
if (((1ll << (Port - 1)) & Mask) == 0) // Check MMASK if (((1 << (Port - 1)) & Mask) == 0) // Check MMASK
return 0; return 0;

View File

@ -1,26 +1,26 @@
G8BPQ-1 1669106746 G8BPQ-1 1681280155
GM8BPQ-3 1669106749 GM8BPQ-3 1681280155
KB8UVN-6 1669106746 KB8UVN-6 1681280155
N8BHL-6 1669106746 N8BHL-6 1681280155
KF8MZ-6 1669106746 KF8MZ-6 1681280155
W8BAP-6 1669106746 W8BAP-6 1681280155
G8BPQ-4 1669106746 G8BPQ-4 1681280155
EI2GYB-4 1669106746 EI2GYB-4 1681280155
IZ4FVW-10 1669106746 IZ4FVW-10 1681280155
PE1NNZ-5 1669106746 PE1NNZ-5 1681280155
PI1LAP-4 1669106746 PI1LAP-4 1681280155
K8OPG-14 1669106746 K8OPG-14 1681280155
KB9PVH-11 1669106746 KB9PVH-11 1681280155
N0NJY-11 1669106746 N0NJY-11 1681280155
N3MEL-3 1669106746 N3MEL-3 1681280155
K5DAT-11 1669106746 K5DAT-11 1681280155
N2UEM-11 1669106746 N2UEM-11 1681280155
W9IKU-11 1669106746 W9IKU-11 1681280155
WA3WLH-11 1669106746 WA3WLH-11 1681280155
WA3WLH-14 1669106746 WA3WLH-14 1681280155
PE1RRR-4 1669106746 PE1RRR-4 1681280155
MS0HFI-4 1669106746 MS0HFI-4 1681280155
AE5E-2 1669106746 AE5E-2 1681280155
G0BMH-4 1669106746 G0BMH-4 1681280155
OH5RM-8 1669106746 OH5RM-8 1681280155
GM8BPQ-4 1669106746 GM8BPQ-4 1681280155

View File

@ -122,6 +122,9 @@ VOID FLRIGPoll(struct RIGPORTINFO * PORT);
void ProcessFLRIGFrame(struct RIGPORTINFO * PORT); void ProcessFLRIGFrame(struct RIGPORTINFO * PORT);
VOID FLRIGSendCommand(struct RIGPORTINFO * PORT, char * Command, char * Value); VOID FLRIGSendCommand(struct RIGPORTINFO * PORT, char * Command, char * Value);
VOID ProcessSDRRadioFrame(struct RIGPORTINFO * PORT, int Length);
VOID SDRRadioPoll(struct RIGPORTINFO * PORT);
VOID SetupPortRIGPointers(); VOID SetupPortRIGPointers();
VOID PTTCATThread(struct RIGINFO *RIG); VOID PTTCATThread(struct RIGINFO *RIG);
VOID ConnecttoHAMLIB(struct RIGPORTINFO * PORT); VOID ConnecttoHAMLIB(struct RIGPORTINFO * PORT);
@ -682,9 +685,9 @@ void saveNewFreq(struct RIGINFO * RIG, double Freq, char * Mode)
// Need version that doesn't need Port Number // Need version that doesn't need Port Number
int Rig_CommandEx(struct RIGPORTINFO * PORT, struct RIGINFO * RIG, int Session, char * Command); int Rig_CommandEx(struct RIGPORTINFO * PORT, struct RIGINFO * RIG, TRANSPORTENTRY * Session, char * Command);
int Rig_Command(int Session, char * Command) int Rig_Command(TRANSPORTENTRY * Session, char * Command)
{ {
char * ptr; char * ptr;
int i, n, p, Port; int i, n, p, Port;
@ -705,8 +708,7 @@ int Rig_Command(int Session, char * Command)
{ {
if (CheckOneTimePassword(&Command[5], AuthPassword)) if (CheckOneTimePassword(&Command[5], AuthPassword))
{ {
L4 += Session; Session->Secure_Session = 1;
L4->Secure_Session = 1;
sprintf(Command, "Ok\r"); sprintf(Command, "Ok\r");
@ -720,11 +722,9 @@ int Rig_Command(int Session, char * Command)
return FALSE; return FALSE;
} }
if (Session != -1) // Used for internal Stop/Start if (Session != (TRANSPORTENTRY *) -1) // Used for internal Stop/Start
{ {
L4 += Session; if (Session->Secure_Session == 0)
if (L4->Secure_Session == 0)
{ {
sprintf(Command, "Sorry - you are not allowed to use this command\r"); sprintf(Command, "Sorry - you are not allowed to use this command\r");
return FALSE; return FALSE;
@ -802,7 +802,7 @@ static char Req[] = "<?xml version=\"1.0\"?>\r\n"
int Rig_CommandEx(struct RIGPORTINFO * PORT, struct RIGINFO * RIG, int Session, char * Command) int Rig_CommandEx(struct RIGPORTINFO * PORT, struct RIGINFO * RIG, TRANSPORTENTRY * Session, char * Command)
{ {
int n, ModeNo, Filter, Port = 0; int n, ModeNo, Filter, Port = 0;
double Freq = 0.0; double Freq = 0.0;
@ -833,8 +833,7 @@ int Rig_CommandEx(struct RIGPORTINFO * PORT, struct RIGINFO * RIG, int Session,
{ {
if (CheckOneTimePassword(&Command[5], AuthPassword)) if (CheckOneTimePassword(&Command[5], AuthPassword))
{ {
L4 += Session; Session->Secure_Session = 1;
L4->Secure_Session = 1;
sprintf(Command, "Ok\r"); sprintf(Command, "Ok\r");
@ -848,11 +847,9 @@ int Rig_CommandEx(struct RIGPORTINFO * PORT, struct RIGINFO * RIG, int Session,
return FALSE; return FALSE;
} }
if (Session != -1) // Used for internal Stop/Start if (Session != (TRANSPORTENTRY *) -1) // Used for internal Stop/Start
{ {
L4 += Session; if (Session->Secure_Session == 0)
if (L4->Secure_Session == 0)
{ {
sprintf(Command, "Sorry - you are not allowed to use this command\r"); sprintf(Command, "Sorry - you are not allowed to use this command\r");
return FALSE; return FALSE;
@ -903,7 +900,7 @@ int Rig_CommandEx(struct RIGPORTINFO * PORT, struct RIGINFO * RIG, int Session,
{ {
RIG->ScanStopped &= (0xffffffff ^ (1 << Port)); RIG->ScanStopped &= (0xffffffff ^ (1 << Port));
if (Session != -1) // Used for internal Stop/Start if (Session != (TRANSPORTENTRY *) -1) // Used for internal Stop/Start
RIG->ScanStopped &= 0xfffffffe; // Clear Manual Stopped Bit RIG->ScanStopped &= 0xfffffffe; // Clear Manual Stopped Bit
if (n > 2) if (n > 2)
@ -933,7 +930,7 @@ int Rig_CommandEx(struct RIGPORTINFO * PORT, struct RIGINFO * RIG, int Session,
{ {
RIG->ScanStopped |= (1 << Port); RIG->ScanStopped |= (1 << Port);
if (Session != -1) // Used for internal Stop/Start if (Session != (TRANSPORTENTRY *) -1) // Used for internal Stop/Start
RIG->ScanStopped |= 1; // Set Manual Stopped Bit RIG->ScanStopped |= 1; // Set Manual Stopped Bit
MySetWindowText(RIG->hSCAN, ""); MySetWindowText(RIG->hSCAN, "");
@ -954,7 +951,7 @@ int Rig_CommandEx(struct RIGPORTINFO * PORT, struct RIGINFO * RIG, int Session,
if (RIG->RIGOK == 0) if (RIG->RIGOK == 0)
{ {
if (Session != -1) if (Session != (TRANSPORTENTRY *) -1)
{ {
if (PORT->Closed) if (PORT->Closed)
sprintf(Command, "Sorry - Radio port closed\r"); sprintf(Command, "Sorry - Radio port closed\r");
@ -982,8 +979,15 @@ int Rig_CommandEx(struct RIGPORTINFO * PORT, struct RIGINFO * RIG, int Session,
return FALSE; return FALSE;
} }
RIG->Session = Session; // BPQ Stream if (Session != (void *)-1)
{
if (Session->CIRCUITINDEX == 255)
RIG->Session = -1;
else
RIG->Session = Session->CIRCUITINDEX; // BPQ Stream
RIG->PollCounter = 50; // Dont read freq for 5 secs in case clash with Poll RIG->PollCounter = 50; // Dont read freq for 5 secs in case clash with Poll
}
if (_stricmp(FreqString, "TUNE") == 0) if (_stricmp(FreqString, "TUNE") == 0)
{ {
@ -1834,10 +1838,50 @@ int Rig_CommandEx(struct RIGPORTINFO * PORT, struct RIGINFO * RIG, int Session,
return TRUE; return TRUE;
case KENWOOD: case SDRRADIO:
case FT2000:
case FT991A: if (n < 3)
case FLEX: {
strcpy(Command, "Sorry - Invalid Format - should be Port Freq Mode\r");
return FALSE;
}
for (ModeNo = 0; ModeNo < 16; ModeNo++)
{
if (_stricmp(KenwoodModes[ModeNo], Mode) == 0)
break;
}
if (ModeNo > 15)
{
sprintf(Command, "Sorry -Invalid Mode\r");
return FALSE;
}
buffptr = GetBuff();
if (buffptr == 0)
{
sprintf(Command, "Sorry - No Buffers available\r");
return FALSE;
}
// Build a ScanEntry in the buffer
FreqPtr = (struct ScanEntry *)buffptr->Data;
memset(FreqPtr, 0, sizeof(struct ScanEntry));
FreqPtr->Freq = Freq;
FreqPtr->Bandwidth = Bandwidth;
FreqPtr->Antenna = Antenna;
Poll = FreqPtr->Cmd1 = FreqPtr->Cmd1Msg;
FreqPtr->Cmd1Len = sprintf(Poll, "F%c00%s;MD%d;F%c;MD;", RIG->RigAddr, FreqString, ModeNo, RIG->RigAddr);
C_Q_ADD(&RIG->BPQtoRADIO_Q, buffptr);
return TRUE;
if (n < 3) if (n < 3)
{ {
@ -1907,6 +1951,8 @@ int Rig_CommandEx(struct RIGPORTINFO * PORT, struct RIGINFO * RIG, int Session,
return TRUE; return TRUE;
case NMEA: case NMEA:
if (n < 3) if (n < 3)
@ -2570,6 +2616,11 @@ BOOL Rig_Poll()
KenwoodPoll(PORT); KenwoodPoll(PORT);
break; break;
case SDRRADIO:
SDRRadioPoll(PORT);
break;
case HAMLIB: case HAMLIB:
HAMLIBPoll(PORT); HAMLIBPoll(PORT);
break; break;
@ -2580,10 +2631,7 @@ BOOL Rig_Poll()
case FLRIG: case FLRIG:
FLRIGPoll(PORT); FLRIGPoll(PORT);
break; break; }
}
} }
// Build page for Web Display // Build page for Web Display
@ -2858,6 +2906,25 @@ void CheckRX(struct RIGPORTINFO * PORT)
PORT->RXLen = 0; // Ready for next frame PORT->RXLen = 0; // Ready for next frame
return; return;
case SDRRADIO:
if (Length < 2) // Minimum Frame Sise
return;
if (Length > 50) // Garbage
{
PORT->RXLen = 0; // Ready for next frame
return;
}
if (PORT->RXBuffer[Length-1] != ';')
return;
ProcessSDRRadioFrame(PORT, Length);
PORT->RXLen = 0; // Ready for next frame
return;
case NMEA: case NMEA:
ptr = memchr(PORT->RXBuffer, 0x0a, Length); ptr = memchr(PORT->RXBuffer, 0x0a, Length);
@ -3576,7 +3643,7 @@ SetFinished:
// Set Mode Response - if scanning read freq, else return OK to user // Set Mode Response - if scanning read freq, else return OK to user
if (RIG->ScanStopped == 0) if (RIG->ScanStopped == 0 && PORT->AutoPoll)
{ {
ReleasePermission(RIG); // Release Perrmission ReleasePermission(RIG); // Release Perrmission
@ -4353,6 +4420,134 @@ VOID ProcessNMEA(struct RIGPORTINFO * PORT, char * Msg, int Length)
//FA00014103000;MD2; //FA00014103000;MD2;
VOID ProcessSDRRadioFrame(struct RIGPORTINFO * PORT, int Length)
{
UCHAR * Poll = PORT->TXBuffer;
UCHAR * Msg = PORT->RXBuffer;
struct RIGINFO * RIG = &PORT->Rigs[0];
UCHAR * ptr;
int CmdLen;
int i;
Msg[Length] = 0;
Debugprintf(Msg);
if (PORT->PORTOK == FALSE)
{
// Just come up
PORT->PORTOK = TRUE;
}
if (!PORT->AutoPoll)
{
// Response to a RADIO Command
if (Msg[0] == '?')
SendResponse(RIG->Session, "Sorry - Command Rejected");
else if (Msg[0] == 'A' && Msg[1] == 'C')
SendResponse(RIG->Session, "TUNE OK");
else if (Msg[0] == 'P' && Msg[1] == 'C')
SendResponse(RIG->Session, "Power Set OK");
else
SendResponse(RIG->Session, "Mode and Frequency Set OK");
PORT->AutoPoll = TRUE;
return;
}
LoopR:
ptr = strchr(Msg, ';');
CmdLen = (int)(ptr - Msg + 1);
// Find Device. FA to FF for frequency
// Note. SDRConsole reports the same mode for all receivers, so don't rely on reported mode
if (Msg[0] == 'F')
{
for (i = 0; i < PORT->ConfiguredRigs; i++)
{
RIG = &PORT->Rigs[i];
if (Msg[1] == RIG->RigAddr)
goto ok;
}
return;
ok:
if (CmdLen > 9)
{
char CharMHz[16] = "";
char CharHz[16] = "";
int i;
long long Freq;
long long MHz, Hz;
RIG->RIGOK = TRUE;
Freq = strtoll(&Msg[2], NULL, 10) + RIG->rxOffset;
RIG->RigFreq = Freq / 1000000.0;
// If we convert to float to display we get rounding errors, so convert to MHz and Hz to display
MHz = Freq / 1000000;
Hz = Freq - MHz * 1000000;
sprintf(CharMHz, "%lld", MHz);
sprintf(CharHz, "%06lld", Hz);
for (i = 5; i > 2; i--)
{
if (CharHz[i] == '0')
CharHz[i] = 0;
else
break;
}
sprintf(RIG->WEB_FREQ,"%lld.%s", MHz, CharHz);
SetWindowText(RIG->hFREQ, RIG->WEB_FREQ);
strcpy(RIG->Valchar, RIG->WEB_FREQ);
PORT->Timeout = 0;
}
}
else if (Msg[0] == 'M' && Msg[1] == 'D')
{
int Mode;
Mode = Msg[2] - 48;
if (Mode > 7) Mode = 7;
SetWindowText(RIG->hMODE, KenwoodModes[Mode]);
strcpy(RIG->WEB_MODE, KenwoodModes[Mode]);
strcpy(RIG->ModeString, RIG->WEB_MODE);
}
if (CmdLen < Length)
{
// Another Message in Buffer
ptr++;
Length -= (int)(ptr - Msg);
if (Length <= 0)
return;
memmove(Msg, ptr, Length +1);
goto LoopR;
}
}
VOID ProcessKenwoodFrame(struct RIGPORTINFO * PORT, int Length) VOID ProcessKenwoodFrame(struct RIGPORTINFO * PORT, int Length)
{ {
UCHAR * Poll = PORT->TXBuffer; UCHAR * Poll = PORT->TXBuffer;
@ -4388,7 +4583,6 @@ VOID ProcessKenwoodFrame(struct RIGPORTINFO * PORT, int Length)
return; return;
} }
Loop: Loop:
if (PORT->PortType == FLEX) if (PORT->PortType == FLEX)
@ -4643,6 +4837,162 @@ VOID KenwoodPoll(struct RIGPORTINFO * PORT)
return; return;
} }
VOID SDRRadioPoll(struct RIGPORTINFO * PORT)
{
UCHAR * Poll = PORT->TXBuffer;
struct RIGINFO * RIG;
int i;
for (i=0; i< PORT->ConfiguredRigs; i++)
{
RIG = &PORT->Rigs[i];
if (RIG->ScanStopped == 0)
if (RIG->ScanCounter)
RIG->ScanCounter--;
}
if (PORT->Timeout)
{
PORT->Timeout--;
if (PORT->Timeout) // Still waiting
return;
PORT->Retries--;
if(PORT->Retries)
{
RigWriteCommBlock(PORT); // Retransmit Block
return;
}
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
PORT->CurrentRig++;
if (PORT->CurrentRig >= PORT->ConfiguredRigs)
PORT->CurrentRig = 0;
RIG = &PORT->Rigs[PORT->CurrentRig];
if (RIG->NumberofBands && RIG->RIGOK && (RIG->ScanStopped == 0))
{
if (RIG->ScanCounter <= 0)
{
// Send Next Freq
if (GetPermissionToChange(PORT, RIG))
{
if (RIG->RIG_DEBUG)
Debugprintf("BPQ32 Change Freq to %9.4f", PORT->FreqPtr->Freq);
memcpy(PORT->TXBuffer, PORT->FreqPtr->Cmd1, PORT->FreqPtr->Cmd1Len);
PORT->TXLen = PORT->FreqPtr->Cmd1Len;
_gcvt(PORT->FreqPtr->Freq / 1000000.0, 9, RIG->Valchar); // For MH
RigWriteCommBlock(PORT);
PORT->CmdSent = 1;
PORT->Retries = 0;
PORT->Timeout = 0;
PORT->AutoPoll = TRUE;
// There isn't a response to a set command, so clear Scan Lock here
ReleasePermission(RIG); // Release Perrmission
return;
}
}
}
if (RIG->RIGOK && RIG->BPQtoRADIO_Q)
{
struct MSGWITHOUTLEN * buffptr;
buffptr = Q_REM(&RIG->BPQtoRADIO_Q);
// Copy the ScanEntry struct from the Buffer to the PORT Scanentry
memcpy(&PORT->ScanEntry, buffptr->Data, sizeof(struct ScanEntry));
PORT->FreqPtr = &PORT->ScanEntry; // Block we are currently sending.
if (RIG->RIG_DEBUG)
Debugprintf("BPQ32 Change Freq to %9.4f", PORT->FreqPtr->Freq);
DoBandwidthandAntenna(RIG, &PORT->ScanEntry);
_gcvt(PORT->FreqPtr->Freq / 1000000.0, 9, RIG->Valchar); // For MH
memcpy(Poll, PORT->FreqPtr->Cmd1, PORT->FreqPtr->Cmd1Len);
PORT->TXLen = PORT->FreqPtr->Cmd1Len;
RigWriteCommBlock(PORT);
PORT->CmdSent = Poll[4];
PORT->Timeout = 0;
RIG->PollCounter = 10;
ReleaseBuffer(buffptr);
PORT->AutoPoll = FALSE;
return;
}
if (RIG->PollCounter)
{
RIG->PollCounter--;
if (RIG->PollCounter > 1)
return;
}
if (RIG->RIGOK && RIG->ScanStopped == 0 && RIG->NumberofBands &&
RIG->ScanCounter && RIG->ScanCounter < 30)
return; // no point in reading freq if we are about to change it
// Need to make sure we don't poll multiple rigs on port at the same time
if (RIG->RIGOK)
{
PORT->Retries = 2;
RIG->PollCounter = 10 / PORT->ConfiguredRigs; // Once Per Sec
}
else
{
PORT->Retries = 1;
RIG->PollCounter = 100 / PORT->ConfiguredRigs; // Slow Poll if down
}
RIG->PollCounter += PORT->CurrentRig * 3;
// Read Frequency
PORT->TXLen = RIG->PollLen;
strcpy(Poll, RIG->Poll);
RigWriteCommBlock(PORT);
PORT->Retries = 1;
PORT->Timeout = 10;
PORT->CmdSent = 0;
PORT->AutoPoll = TRUE;
return;
}
VOID DummyPoll(struct RIGPORTINFO * PORT) VOID DummyPoll(struct RIGPORTINFO * PORT)
{ {
UCHAR * Poll = PORT->TXBuffer; UCHAR * Poll = PORT->TXBuffer;
@ -5185,7 +5535,7 @@ struct RIGINFO * RigConfig(struct TNCINFO * TNC, char * buf, int Port)
else else
COMPort = ptr; COMPort = ptr;
// See if port is already defined. We may be adding another radio (ICOM only) or updating an existing one // See if port is already defined. We may be adding another radio (ICOM or SDRRADIO only) or updating an existing one
// Unless CM108 - they must be on separate Ports // Unless CM108 - they must be on separate Ports
@ -5278,6 +5628,8 @@ PortFound:
PORT->PortType = YAESU; PORT->PortType = YAESU;
else if (strcmp(ptr, "KENWOOD") == 0) else if (strcmp(ptr, "KENWOOD") == 0)
PORT->PortType = KENWOOD; PORT->PortType = KENWOOD;
else if (strcmp(ptr, "SDRRADIO") == 0)
PORT->PortType = SDRRADIO; // Varient of KENWOOD that supports multiple devices on one serial port
else if (strcmp(ptr, "FLEX") == 0) else if (strcmp(ptr, "FLEX") == 0)
PORT->PortType = FLEX; PORT->PortType = FLEX;
else if (strcmp(ptr, "NMEA") == 0) else if (strcmp(ptr, "NMEA") == 0)
@ -5378,13 +5730,17 @@ PortFound:
} }
// If ICOM, we may be adding a new Rig // If ICOM or SDRRADIO, we may be adding a new Rig
ptr = strtok_s(NULL, " \t\n\r", &Context); ptr = strtok_s(NULL, " \t\n\r", &Context);
if (PORT->PortType == ICOM || PORT->PortType == NMEA) if (PORT->PortType == ICOM || PORT->PortType == NMEA || PORT->PortType == SDRRADIO)
{ {
if (ptr == NULL) return (FALSE); if (ptr == NULL) return (FALSE);
if (PORT->PortType == SDRRADIO)
RigAddr = ptr[0];
else
sscanf(ptr, "%x", &RigAddr); sscanf(ptr, "%x", &RigAddr);
// See if already defined // See if already defined
@ -5884,7 +6240,29 @@ CheckOtherParams:
RIG->PTTOffLen = (int)strlen(RIG->PTTOff); RIG->PTTOffLen = (int)strlen(RIG->PTTOff);
} }
else if (PORT->PortType == FLEX) else if (PORT->PortType == SDRRADIO)
{
RIG->PollLen = sprintf(RIG->Poll, "F%c;MD;", RIG->RigAddr);
/* if (PTTControlsInputMUX)
{
sprintf(RIG->PTTOn, "EX%03d00001;TX1;", RIG->TSMenu); // Select USB before PTT
sprintf(RIG->PTTOff, "RX;EX%03d00000;", RIG->TSMenu); // Select ACC after dropping PTT
}
else
{
strcpy(RIG->PTTOff, "RX;");
if (DataPTT)
strcpy(RIG->PTTOn, "TX1;");
else
strcpy(RIG->PTTOn, "TX;");
}
*/
RIG->PTTOnLen = (int)strlen(RIG->PTTOn);
RIG->PTTOffLen = (int)strlen(RIG->PTTOff);
} else if (PORT->PortType == FLEX)
{ {
RIG->PollLen = 10; RIG->PollLen = 10;
strcpy(RIG->Poll, "ZZFA;ZZMD;"); strcpy(RIG->Poll, "ZZFA;ZZMD;");
@ -7234,22 +7612,23 @@ void ProcessFLRIGFrame(struct RIGPORTINFO * PORT)
Length = PORT->RXLen; Length = PORT->RXLen;
msg[Length] = 0; msg[Length] = 0;
ptr1 = strstr(msg, "Content-length:"); ptr1 = strstr(msg, "Content-length:");
if (ptr1 == NULL) if (ptr1 == NULL)
return; return;
Len = atoi(&ptr1[15]);
ptr2 = strstr(ptr1, "\r\n\r\n"); ptr2 = strstr(ptr1, "\r\n\r\n");
if (ptr2)
{ if (ptr2 == NULL)
TotalLen = ptr2 +4 + Len - msg; return;
Len = atoi(&ptr1[15]);
TotalLen = ptr2 + 4 + Len - msg;
if (TotalLen > Length) // Don't have it all if (TotalLen > Length) // Don't have it all
return; return;
}
else
return;
val = strstr(ptr2, "<value>"); val = strstr(ptr2, "<value>");
@ -7260,8 +7639,6 @@ void ProcessFLRIGFrame(struct RIGPORTINFO * PORT)
RIG->RIGOK = 1; RIG->RIGOK = 1;
PORT->RXLen -= TotalLen; PORT->RXLen -= TotalLen;
memmove(PORT->RXBuffer, &PORT->RXBuffer[TotalLen], PORT->RXLen);
// It is quite difficult to corrolate responses with commands, but we only poll for freq, mode and bandwidth // It is quite difficult to corrolate responses with commands, but we only poll for freq, mode and bandwidth
// and the responses can be easily identified // and the responses can be easily identified
@ -7458,6 +7835,11 @@ void ProcessFLRIGFrame(struct RIGPORTINFO * PORT)
*/ */
} }
if (PORT->RXLen > 0)
memmove(PORT->RXBuffer, &PORT->RXBuffer[TotalLen], PORT->RXLen);
else
PORT->RXLen = 0;
PORT->Timeout = 0; PORT->Timeout = 0;
} }
@ -7509,7 +7891,7 @@ void HLSetMode(SOCKET Sock, struct RIGINFO * RIG, unsigned char * Msg, char sep)
sprintf(Resp, "%d %s %s\n", 0, RIG->Valchar, mode); sprintf(Resp, "%d %s %s\n", 0, RIG->Valchar, mode);
GetSemaphore(&Semaphore, 60); GetSemaphore(&Semaphore, 60);
Rig_CommandEx(RIG->PORT, RIG, -1, Resp); Rig_CommandEx(RIG->PORT, RIG, (TRANSPORTENTRY *) -1, Resp);
FreeSemaphore(&Semaphore); FreeSemaphore(&Semaphore);
if (sep) if (sep)
@ -7531,7 +7913,7 @@ void HLSetFreq(SOCKET Sock, struct RIGINFO * RIG, unsigned char * Msg, char sep)
sprintf(Resp, "%d %f\n", 0, freq/1000000.0); sprintf(Resp, "%d %f\n", 0, freq/1000000.0);
GetSemaphore(&Semaphore, 60); GetSemaphore(&Semaphore, 60);
Rig_CommandEx(RIG->PORT, RIG, -1, Resp); Rig_CommandEx(RIG->PORT, RIG, (TRANSPORTENTRY *) -1, Resp);
FreeSemaphore(&Semaphore); FreeSemaphore(&Semaphore);
if (sep) if (sep)

View File

@ -1340,7 +1340,7 @@ VOID SCSPoll(int Port)
sprintf(Status, "%d SCANSTOP", TNC->Port); sprintf(Status, "%d SCANSTOP", TNC->Port);
TNC->SwitchToPactor = 0; // Cancel any RP to Pactor switch TNC->SwitchToPactor = 0; // Cancel any RP to Pactor switch
Rig_Command(-1, Status); Rig_Command((TRANSPORTENTRY *) -1, Status);
} }
else else
{ {
@ -1927,7 +1927,7 @@ VOID SCSPoll(int Port)
{ {
sprintf(&Buffer[40], "%d %s", TNC->Port, &Buffer[6]); sprintf(&Buffer[40], "%d %s", TNC->Port, &Buffer[6]);
if (Rig_Command(TNC->PortRecord->ATTACHEDSESSIONS[0]->L4CROSSLINK->CIRCUITINDEX, &Buffer[40])) if (Rig_Command(TNC->PortRecord->ATTACHEDSESSIONS[0]->L4CROSSLINK, &Buffer[40]))
{ {
ReleaseBuffer(buffptr); ReleaseBuffer(buffptr);
} }
@ -3368,7 +3368,7 @@ VOID ProcessDEDFrame(struct TNCINFO * TNC, UCHAR * Msg, int framelen)
TNC->SwitchToPactor = 0; // Cancel any RP to Pactor switch TNC->SwitchToPactor = 0; // Cancel any RP to Pactor switch
sprintf(Status, "%d SCANSTOP", TNC->Port); sprintf(Status, "%d SCANSTOP", TNC->Port);
Rig_Command(-1, Status); Rig_Command((TRANSPORTENTRY *) -1, Status);
SuspendOtherPorts(TNC); // Prevent connects on other ports in same scan gruop SuspendOtherPorts(TNC); // Prevent connects on other ports in same scan gruop
@ -3394,7 +3394,7 @@ VOID ProcessDEDFrame(struct TNCINFO * TNC, UCHAR * Msg, int framelen)
{ {
TidyClose(TNC, Stream); TidyClose(TNC, Stream);
sprintf(Status, "%d SCANSTART 15", TNC->Port); sprintf(Status, "%d SCANSTART 15", TNC->Port);
Rig_Command(-1, Status); Rig_Command((TRANSPORTENTRY *) -1, Status);
Debugprintf("SCS Call from %s rejected", MHCall); Debugprintf("SCS Call from %s rejected", MHCall);
return; return;
} }
@ -3422,7 +3422,7 @@ VOID ProcessDEDFrame(struct TNCINFO * TNC, UCHAR * Msg, int framelen)
TidyClose(TNC, 0); TidyClose(TNC, 0);
sprintf(Status, "%d SCANSTART 15", TNC->Port); sprintf(Status, "%d SCANSTART 15", TNC->Port);
Rig_Command(-1, Status); Rig_Command((TRANSPORTENTRY *) -1, Status);
Debugprintf("Pactor Call from %s not in ValidCalls - rejected", Call); Debugprintf("Pactor Call from %s not in ValidCalls - rejected", Call);
return; return;
} }
@ -3557,7 +3557,7 @@ VOID ProcessDEDFrame(struct TNCINFO * TNC, UCHAR * Msg, int framelen)
Debugprintf("RP SABM is for NODECALL or one of our APPLCalls - setting MYCALL to %s and pausing scan", DestCall); Debugprintf("RP SABM is for NODECALL or one of our APPLCalls - setting MYCALL to %s and pausing scan", DestCall);
sprintf(Status, "%d SCANSTART 30", TNC->Port); sprintf(Status, "%d SCANSTART 30", TNC->Port);
Rig_Command(-1, Status); Rig_Command((TRANSPORTENTRY *) -1, Status);
TNC->SwitchToPactor = 0; // Stay in RP TNC->SwitchToPactor = 0; // Stay in RP
strcpy(STREAM->MyCall, DestCall); strcpy(STREAM->MyCall, DestCall);
@ -4120,7 +4120,7 @@ VOID CloseComplete(struct TNCINFO * TNC, int Stream)
SetWindowText(TNC->xIDC_TNCSTATE, "Free"); SetWindowText(TNC->xIDC_TNCSTATE, "Free");
strcpy(TNC->WEB_TNCSTATE, "Free"); strcpy(TNC->WEB_TNCSTATE, "Free");
sprintf(Status, "%d SCANSTART 15", TNC->Port); sprintf(Status, "%d SCANSTART 15", TNC->Port);
Rig_Command(-1, Status); Rig_Command((TRANSPORTENTRY *) -1, Status);
if (TNC->Dragon) if (TNC->Dragon)
{ {

View File

@ -1629,7 +1629,7 @@ static VOID ProcessDEDFrame(struct TNCINFO * TNC)
Debugprintf("RP SABM is for NODECALL or one of our APPLCalls - setting MYCALL to %s and pausing scan", DestCall); Debugprintf("RP SABM is for NODECALL or one of our APPLCalls - setting MYCALL to %s and pausing scan", DestCall);
sprintf(Status, "%d SCANSTART 60", TNC->Port); // Pause scan for 60 secs sprintf(Status, "%d SCANSTART 60", TNC->Port); // Pause scan for 60 secs
Rig_Command(-1, Status); Rig_Command( (TRANSPORTENTRY *) -1, Status);
TNC->SwitchToPactor = 600; // Don't change modes for 60 secs TNC->SwitchToPactor = 600; // Don't change modes for 60 secs
strcpy(STREAM->MyCall, DestCall); strcpy(STREAM->MyCall, DestCall);

View File

@ -1037,7 +1037,7 @@ VOID DEDPoll(int Port)
TNC->SwitchToPactor = 0; // Cancel any RP to Pactor switch TNC->SwitchToPactor = 0; // Cancel any RP to Pactor switch
sprintf(Status, "%d SCANSTOP", TNC->Port); sprintf(Status, "%d SCANSTOP", TNC->Port);
Rig_Command(-1, Status); Rig_Command( (TRANSPORTENTRY *) -1, Status);
SuspendOtherPorts(TNC); // Prevent connects on other ports in same scan gruop SuspendOtherPorts(TNC); // Prevent connects on other ports in same scan gruop
} }
@ -1314,7 +1314,7 @@ reinit:
{ {
sprintf(&Buffer[40], "%d %s", TNC->Port, &Buffer[6]); sprintf(&Buffer[40], "%d %s", TNC->Port, &Buffer[6]);
if (Rig_Command(TNC->PortRecord->ATTACHEDSESSIONS[0]->L4CROSSLINK->CIRCUITINDEX, &Buffer[40])) if (Rig_Command(TNC->PortRecord->ATTACHEDSESSIONS[0]->L4CROSSLINK, &Buffer[40]))
{ {
ReleaseBuffer(buffptr); ReleaseBuffer(buffptr);
} }
@ -2027,7 +2027,7 @@ VOID TrkProcessDEDFrame(struct TNCINFO * TNC)
TNC->SwitchToPactor = 0; // Cancel any RP to Pactor switch TNC->SwitchToPactor = 0; // Cancel any RP to Pactor switch
sprintf(Status, "%d SCANSTOP", TNC->Port); sprintf(Status, "%d SCANSTOP", TNC->Port);
Rig_Command(-1, Status); Rig_Command( (TRANSPORTENTRY *) -1, Status);
memcpy(MHCall, Call, 9); memcpy(MHCall, Call, 9);
MHCall[9] = 0; MHCall[9] = 0;
@ -2315,7 +2315,7 @@ VOID TrkProcessDEDFrame(struct TNCINFO * TNC)
Debugprintf("RP SABM is for NODECALL or one of our APPLCalls - setting MYCALL to %s and pausing scan", DestCall); Debugprintf("RP SABM is for NODECALL or one of our APPLCalls - setting MYCALL to %s and pausing scan", DestCall);
sprintf(Status, "%d SCANSTART 60", TNC->Port); // Pause scan for 60 secs sprintf(Status, "%d SCANSTART 60", TNC->Port); // Pause scan for 60 secs
Rig_Command(-1, Status); Rig_Command( (TRANSPORTENTRY *) -1, Status);
if ((TNC->RIG == &TNC->DummyRig || TNC->RIG == NULL) && TNC->RobustTime) if ((TNC->RIG == &TNC->DummyRig || TNC->RIG == NULL) && TNC->RobustTime)
TNC->SwitchToPactor = 600; // Don't change modes for 60 secs TNC->SwitchToPactor = 600; // Don't change modes for 60 secs
@ -2576,7 +2576,7 @@ VOID TrkCloseComplete(struct TNCINFO * TNC, int Stream)
TNC->WEB_CHANGED = TRUE; TNC->WEB_CHANGED = TRUE;
Rig_Command(-1, Status); Rig_Command( (TRANSPORTENTRY *) -1, Status);
if (TNC->RIG == &TNC->DummyRig) // Not using Rig control if (TNC->RIG == &TNC->DummyRig) // Not using Rig control
TNC->SwitchToPactor = TNC->RobustTime; TNC->SwitchToPactor = TNC->RobustTime;

View File

@ -390,7 +390,7 @@ ok:
sprintf(Msg, "%d SCANSTOP", TNC->Port); sprintf(Msg, "%d SCANSTOP", TNC->Port);
Rig_Command(-1, Msg); Rig_Command( (TRANSPORTENTRY *) -1, Msg);
} }
if (STREAM->Attached) if (STREAM->Attached)
@ -519,7 +519,7 @@ ok:
{ {
sprintf(&buff->L2DATA[0], "%d %s", TNC->Port, &buff->L2DATA[6]); sprintf(&buff->L2DATA[0], "%d %s", TNC->Port, &buff->L2DATA[6]);
if (Rig_Command(TNC->PortRecord->ATTACHEDSESSIONS[0]->L4CROSSLINK->CIRCUITINDEX, &buff->L2DATA[0])) if (Rig_Command(TNC->PortRecord->ATTACHEDSESSIONS[0]->L4CROSSLINK, &buff->L2DATA[0]))
{ {
} }
else else
@ -724,7 +724,7 @@ VOID SerialReleaseTNC(struct TNCINFO * TNC)
sprintf(TXMsg, "%d SCANSTART 15", TNC->Port); sprintf(TXMsg, "%d SCANSTART 15", TNC->Port);
Rig_Command(-1, TXMsg); Rig_Command( (TRANSPORTENTRY *) -1, TXMsg);
ReleaseOtherPorts(TNC); ReleaseOtherPorts(TNC);

View File

@ -4970,7 +4970,7 @@ int DataSocket_ReadHTTP(struct TNCINFO * TNC, struct ConnectionInfo * sockptr, S
char RigCMD[64]; char RigCMD[64];
sprintf(RigCMD, "%s PTT", &MsgPtr[6]); sprintf(RigCMD, "%s PTT", &MsgPtr[6]);
Rig_Command(-1, RigCMD); Rig_Command( (TRANSPORTENTRY *) -1, RigCMD);
} }
else if (memcmp(sockptr->WebURL, "WMRefresh", 9) == 0) else if (memcmp(sockptr->WebURL, "WMRefresh", 9) == 0)
{ {
@ -5521,8 +5521,11 @@ int Telnet_Connected(struct TNCINFO * TNC, struct ConnectionInfo * sockptr, SOCK
} }
else else
{ {
buffptr->Len = sprintf(&buffptr->Data[0], "Connected to %s\r", if (TNC->PortRecord->ATTACHEDSESSIONS[Stream]->L4CROSSLINK->APPL[0])
buffptr->Len = sprintf(&buffptr->Data[0], "*** Connected to %s\r",
TNC->PortRecord->ATTACHEDSESSIONS[Stream]->L4CROSSLINK->APPL); TNC->PortRecord->ATTACHEDSESSIONS[Stream]->L4CROSSLINK->APPL);
else
buffptr->Len = sprintf(&buffptr->Data[0], "*** Connected to APPL\r");
if (sockptr->NoCallsign == FALSE) if (sockptr->NoCallsign == FALSE)
send(sockptr->socket, Signon, sprintf(Signon, "%s\r\n", TNC->Streams[Stream].MyCall), 0); send(sockptr->socket, Signon, sprintf(Signon, "%s\r\n", TNC->Streams[Stream].MyCall), 0);

View File

@ -357,6 +357,147 @@ VOID UZ7HOReleasePort(struct TNCINFO * TNC)
RegisterAPPLCalls(TNC, FALSE); RegisterAPPLCalls(TNC, FALSE);
} }
int UZ7HOSetFreq(int port, struct TNCINFO * TNC, struct AGWINFO * AGW, PDATAMESSAGE buff, PMSGWITHLEN buffptr)
{
int txlen = GetLengthfromBuffer(buff) - (MSGHDDRLEN + 1);
// May be read or set frequency
if (txlen == 5)
{
// Read Freq
buffptr->Len = sprintf((UCHAR *)&buffptr->Data[0], "UZ7HO} Modem Freqency %d\r", AGW->CenterFreq);
return 1;
}
AGW->CenterFreq = atoi(&buff->L2DATA[5]);
if (AGW->CenterFreq == 0)
{
buffptr->Len = sprintf((UCHAR *)&buffptr->Data[0], "UZ7HO} Invalid Modem Freqency\r");
return 1;
}
if (TNCInfo[MasterPort[port]]->AGWInfo->isQTSM == 3)
{
// QtSM so can send Set Freq Command
char Buffer[32] = "";
int MsgLen = 32;
memcpy(Buffer, &AGW->CenterFreq, 4);
AGW->TXHeader.Port = UZ7HOChannel[port];
AGW->TXHeader.DataKind = 'g';
memset(AGW->TXHeader.callfrom, 0, 10);
memset(AGW->TXHeader.callto, 0, 10);
#ifdef __BIG_ENDIAN__
AGW->TXHeader.DataLength = reverse(MsgLen);
#else
AGW->TXHeader.DataLength = MsgLen;
#endif
send(TNCInfo[MasterPort[port]]->TCPSock, (char *)&AGW->TXHeader, AGWHDDRLEN, 0);
send(TNCInfo[MasterPort[port]]->TCPSock, Buffer, MsgLen, 0);
}
#ifdef WIN32
else if (AGW->hFreq)
{
//Using real UZ7HO on Windows
char Freq[16];
sprintf(Freq, "%d", AGW->CenterFreq - 1);
SendMessage(AGW->hFreq, WM_SETTEXT, 0, (LPARAM)Freq);
SendMessage(AGW->hSpin, WM_LBUTTONDOWN, 1, 1);
SendMessage(AGW->hSpin, WM_LBUTTONUP, 0, 1);
}
#endif
else
{
buffptr->Len = sprintf((UCHAR *)&buffptr->Data[0], "UZ7HO} Sorry Setting UZ7HO params not supported on this system\r");
return 1;
}
buffptr->Len = sprintf((UCHAR *)&buffptr->Data[0], "UZ7HO} Modem Freq Set Ok\r");
return 1;
}
int UZ7HOSetModem(int port, struct TNCINFO * TNC, struct AGWINFO * AGW, PDATAMESSAGE buff, PMSGWITHLEN buffptr )
{
int txlen = GetLengthfromBuffer(buff) - (MSGHDDRLEN + 1);
if (txlen == 6)
{
// Read Modem
if (AGW->ModemName[0])
buffptr->Len = sprintf((UCHAR *)&buffptr->Data[0], "UZ7HO} Modem %s\r", AGW->ModemName);
else
buffptr->Len = sprintf((UCHAR *)&buffptr->Data[0], "UZ7HO} Modem Number %d\r", AGW->Modem);
return 1;
}
else if (TNCInfo[MasterPort[port]]->AGWInfo->isQTSM == 3)
{
// Can send modem name to QTSM
char Buffer[32] = "";
int MsgLen = 32;
strlop(buff->L2DATA, '\r');
strlop(buff->L2DATA, '\n');
if (strlen(&buff->L2DATA[6]) > 20)
buff->L2DATA[26] = 0;
strcpy(&Buffer[4], &buff->L2DATA[6]);
AGW->TXHeader.Port = UZ7HOChannel[port];
AGW->TXHeader.DataKind = 'g';
memset(AGW->TXHeader.callfrom, 0, 10);
memset(AGW->TXHeader.callto, 0, 10);
#ifdef __BIG_ENDIAN__
AGW->TXHeader.DataLength = reverse(MsgLen);
#else
AGW->TXHeader.DataLength = MsgLen;
#endif
send(TNCInfo[MasterPort[port]]->TCPSock, (char *)&AGW->TXHeader, AGWHDDRLEN, 0);
send(TNCInfo[MasterPort[port]]->TCPSock, Buffer, MsgLen, 0);
}
#ifdef WIN32
else if (AGW->cbinfo.cbSize)
{
// Real QTSM on Windows
AGW->Modem = atoi(&buff->L2DATA[6]);
if (AGW->cbinfo.cbSize && AGW->cbinfo.hwndCombo)
{
// Set it
LRESULT ret = SendMessage(AGW->cbinfo.hwndCombo, CB_SETCURSEL, AGW->Modem, 0);
int pos = 13 * AGW->Modem + 7;
ret = SendMessage(AGW->cbinfo.hwndCombo, WM_LBUTTONDOWN, 1, 1);
ret = SendMessage(AGW->cbinfo.hwndCombo, WM_LBUTTONUP, 0, 1);
ret = SendMessage(AGW->cbinfo.hwndList, WM_LBUTTONDOWN, 1, pos << 16);
ret = SendMessage(AGW->cbinfo.hwndList, WM_LBUTTONUP, 0, pos << 16);
ret = 0;
}
}
#endif
else
{
buffptr->Len = sprintf((UCHAR *)&buffptr->Data[0], "UZ7HO} Sorry Setting UZ7HO params not supported this system\r");
return 1;
}
buffptr->Len = sprintf((UCHAR *)&buffptr->Data[0], "UZ7HO} Modem Set Ok\r");
return 1;
}
static size_t ExtProc(int fn, int port, PDATAMESSAGE buff) static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
{ {
PMSGWITHLEN buffptr; PMSGWITHLEN buffptr;
@ -396,7 +537,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
// Stop Scanning // Stop Scanning
sprintf(Cmd, "%d SCANSTOP", TNC->Port); sprintf(Cmd, "%d SCANSTOP", TNC->Port);
Rig_Command(-1, Cmd); Rig_Command( (TRANSPORTENTRY *) -1, Cmd);
SuspendOtherPorts(TNC); // Prevent connects on other ports in same scan gruop SuspendOtherPorts(TNC); // Prevent connects on other ports in same scan gruop
@ -761,7 +902,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
{ {
sprintf(&buff->L2DATA[0], "%d %s", TNC->Port, &buff->L2DATA[6]); sprintf(&buff->L2DATA[0], "%d %s", TNC->Port, &buff->L2DATA[6]);
if (Rig_Command(TNC->PortRecord->ATTACHEDSESSIONS[0]->L4CROSSLINK->CIRCUITINDEX, &buff->L2DATA[0])) if (Rig_Command(TNC->PortRecord->ATTACHEDSESSIONS[0]->L4CROSSLINK, &buff->L2DATA[0]))
{ {
} }
else else
@ -819,167 +960,20 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
{ {
PMSGWITHLEN buffptr = (PMSGWITHLEN)GetBuff(); PMSGWITHLEN buffptr = (PMSGWITHLEN)GetBuff();
// May be read or set frequency
if (txlen == 5)
{
// Read Freq
if (buffptr) if (buffptr)
{ {
buffptr->Len = sprintf((UCHAR *)&buffptr->Data[0], "UZ7HO} Modem Freqency %d\r", AGW->CenterFreq); UZ7HOSetFreq(port, TNC, AGW, buff, buffptr);
C_Q_ADD(&STREAM->PACTORtoBPQ_Q, buffptr); C_Q_ADD(&STREAM->PACTORtoBPQ_Q, buffptr);
} }
return 1; return 1;
} }
AGW->CenterFreq = atoi(&buff->L2DATA[5]);
if (AGW->CenterFreq == 0)
{
if (buffptr)
{
buffptr->Len = sprintf((UCHAR *)&buffptr->Data[0], "UZ7HO} Invalid Modem Freqency\r");
C_Q_ADD(&STREAM->PACTORtoBPQ_Q, buffptr);
}
return 1;
}
if (TNCInfo[MasterPort[port]]->AGWInfo->isQTSM == 3)
{
// QtSM so can send Set Freq Command
char Buffer[32] = "";
int MsgLen = 32;
memcpy(Buffer, &AGW->CenterFreq, 4);
AGW->TXHeader.Port = UZ7HOChannel[port];
AGW->TXHeader.DataKind = 'g';
memset(AGW->TXHeader.callfrom, 0, 10);
memset(AGW->TXHeader.callto, 0, 10);
#ifdef __BIG_ENDIAN__
AGW->TXHeader.DataLength = reverse(MsgLen);
#else
AGW->TXHeader.DataLength = MsgLen;
#endif
send(TNCInfo[MasterPort[port]]->TCPSock, (char *)&AGW->TXHeader, AGWHDDRLEN, 0);
send(TNCInfo[MasterPort[port]]->TCPSock, Buffer, MsgLen, 0);
}
#ifdef WIN32
else if (AGW->hFreq)
{
//Using real UZ7HO on Windows
char Freq[16];
sprintf(Freq, "%d", AGW->CenterFreq - 1);
SendMessage(AGW->hFreq, WM_SETTEXT, 0, (LPARAM)Freq);
SendMessage(AGW->hSpin, WM_LBUTTONDOWN, 1, 1);
SendMessage(AGW->hSpin, WM_LBUTTONUP, 0, 1);
}
#endif
else
{
if (buffptr)
{
buffptr->Len = sprintf((UCHAR *)&buffptr->Data[0], "UZ7HO} Sorry Setting UZ7HO params not supported on this system\r");
C_Q_ADD(&STREAM->PACTORtoBPQ_Q, buffptr);
}
return 1;
}
if (buffptr)
{
buffptr->Len = sprintf((UCHAR *)&buffptr->Data[0], "UZ7HO} Modem Freq Set Ok\r");
C_Q_ADD(&STREAM->PACTORtoBPQ_Q, buffptr);
}
return 1;
}
if (_memicmp(&buff->L2DATA[0], "MODEM", 5) == 0) if (_memicmp(&buff->L2DATA[0], "MODEM", 5) == 0)
{ {
PMSGWITHLEN buffptr = (PMSGWITHLEN)GetBuff(); PMSGWITHLEN buffptr = (PMSGWITHLEN)GetBuff();
if (txlen == 6)
{
// Read Modem
if (buffptr) if (buffptr)
{ {
if (AGW->ModemName[0]) UZ7HOSetModem(port, TNC, AGW, buff, buffptr);
buffptr->Len = sprintf((UCHAR *)&buffptr->Data[0], "UZ7HO} Modem %s\r", AGW->ModemName);
else
buffptr->Len = sprintf((UCHAR *)&buffptr->Data[0], "UZ7HO} Modem Number %d\r", AGW->Modem);
C_Q_ADD(&STREAM->PACTORtoBPQ_Q, buffptr);
}
return 1;
}
else if (TNCInfo[MasterPort[port]]->AGWInfo->isQTSM == 3)
{
// Can send modem name to QTSM
char Buffer[32] = "";
int MsgLen = 32;
strlop(buff->L2DATA, '\r');
strlop(buff->L2DATA, '\n');
if (strlen(&buff->L2DATA[6]) > 20)
buff->L2DATA[26] = 0;
strcpy(&Buffer[4], &buff->L2DATA[6]);
AGW->TXHeader.Port = UZ7HOChannel[port];
AGW->TXHeader.DataKind = 'g';
memset(AGW->TXHeader.callfrom, 0, 10);
memset(AGW->TXHeader.callto, 0, 10);
#ifdef __BIG_ENDIAN__
AGW->TXHeader.DataLength = reverse(MsgLen);
#else
AGW->TXHeader.DataLength = MsgLen;
#endif
send(TNCInfo[MasterPort[port]]->TCPSock, (char *)&AGW->TXHeader, AGWHDDRLEN, 0);
send(TNCInfo[MasterPort[port]]->TCPSock, Buffer, MsgLen, 0);
}
#ifdef WIN32
else if (AGW->cbinfo.cbSize)
{
// Real QTSM on Windows
AGW->Modem = atoi(&buff->L2DATA[6]);
if (AGW->cbinfo.cbSize && AGW->cbinfo.hwndCombo)
{
// Set it
LRESULT ret = SendMessage(AGW->cbinfo.hwndCombo, CB_SETCURSEL, AGW->Modem, 0);
int pos = 13 * AGW->Modem + 7;
ret = SendMessage(AGW->cbinfo.hwndCombo, WM_LBUTTONDOWN, 1, 1);
ret = SendMessage(AGW->cbinfo.hwndCombo, WM_LBUTTONUP, 0, 1);
ret = SendMessage(AGW->cbinfo.hwndList, WM_LBUTTONDOWN, 1, pos << 16);
ret = SendMessage(AGW->cbinfo.hwndList, WM_LBUTTONUP, 0, pos << 16);
ret = 0;
}
}
#endif
else
{
if (buffptr)
{
buffptr->Len = sprintf((UCHAR *)&buffptr->Data[0], "UZ7HO} Sorry Setting UZ7HO params not supported this system\r");
C_Q_ADD(&STREAM->PACTORtoBPQ_Q, buffptr);
}
return 1;
}
if (buffptr)
{
buffptr->Len = sprintf((UCHAR *)&buffptr->Data[0], "UZ7HO} Modem Set Ok\r");
C_Q_ADD(&STREAM->PACTORtoBPQ_Q, buffptr); C_Q_ADD(&STREAM->PACTORtoBPQ_Q, buffptr);
} }
return 1; return 1;
@ -2870,7 +2864,7 @@ VOID CloseComplete(struct TNCINFO * TNC, int Stream)
ReleaseOtherPorts(TNC); ReleaseOtherPorts(TNC);
sprintf(Status, "%d SCANSTART 15", TNC->Port); sprintf(Status, "%d SCANSTART 15", TNC->Port);
Rig_Command(-1, Status); Rig_Command( (TRANSPORTENTRY *) -1, Status);
} }
static MESSAGE Monframe; // I frames come in two parts. static MESSAGE Monframe; // I frames come in two parts.

4
V4.c
View File

@ -467,7 +467,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
sprintf(Msg, "%d SCANSTOP", TNC->Port); sprintf(Msg, "%d SCANSTOP", TNC->Port);
Rig_Command(-1, Msg); Rig_Command( (TRANSPORTENTRY *) -1, Msg);
} }
@ -628,7 +628,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
{ {
sprintf(buff->L2DATA, "%d %s", TNC->Port, &buff->L2DATA[6]); sprintf(buff->L2DATA, "%d %s", TNC->Port, &buff->L2DATA[6]);
if (Rig_Command(TNC->PortRecord->ATTACHEDSESSIONS[0]->L4CROSSLINK->CIRCUITINDEX, buff->L2DATA)) if (Rig_Command(TNC->PortRecord->ATTACHEDSESSIONS[0]->L4CROSSLINK, buff->L2DATA))
{ {
} }
else else

392
VARA.c
View File

@ -50,6 +50,11 @@ extern int (WINAPI FAR *EnumProcessesPtr)();
#define WSA_DATA WM_USER + 2 #define WSA_DATA WM_USER + 2
#define WSA_CONNECT WM_USER + 3 #define WSA_CONNECT WM_USER + 3
#define FEND 0xC0
#define FESC 0xDB
#define TFEND 0xDC
#define TFESC 0xDD
static int Socket_Data(int sock, int error, int eventcode); static int Socket_Data(int sock, int error, int eventcode);
int KillTNC(struct TNCINFO * TNC); int KillTNC(struct TNCINFO * TNC);
@ -64,6 +69,9 @@ int VARASendData(struct TNCINFO * TNC, UCHAR * Buff, int Len);
VOID VARASendCommand(struct TNCINFO * TNC, char * Buff, BOOL Queue); VOID VARASendCommand(struct TNCINFO * TNC, char * Buff, BOOL Queue);
VOID VARAProcessDataPacket(struct TNCINFO * TNC, UCHAR * Data, int Length); VOID VARAProcessDataPacket(struct TNCINFO * TNC, UCHAR * Data, int Length);
void CountRestarts(struct TNCINFO * TNC); void CountRestarts(struct TNCINFO * TNC);
int KissEncode(UCHAR * inbuff, UCHAR * outbuff, int len);
VOID PROCESSNODEMESSAGE(MESSAGE * Msg, struct PORTCONTROL * PORT);
VOID NETROMMSG(struct _LINKTABLE * LINK, L3MESSAGEBUFFER * L3MSG);
#ifndef LINBPQ #ifndef LINBPQ
BOOL CALLBACK EnumVARAWindowsProc(HWND hwnd, LPARAM lParam); BOOL CALLBACK EnumVARAWindowsProc(HWND hwnd, LPARAM lParam);
@ -88,6 +96,7 @@ static RECT Rect;
extern struct TNCINFO * TNCInfo[41]; // Records are Malloc'd extern struct TNCINFO * TNCInfo[41]; // Records are Malloc'd
extern void * TRACE_Q;
BOOL VARAStopPort(struct PORTCONTROL * PORT) BOOL VARAStopPort(struct PORTCONTROL * PORT)
{ {
@ -490,7 +499,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
sprintf(Msg, "%d SCANSTOP", TNC->Port); sprintf(Msg, "%d SCANSTOP", TNC->Port);
Rig_Command(-1, Msg); Rig_Command( (TRANSPORTENTRY *) -1, Msg);
} }
if (TNC->Streams[0].Attached) if (TNC->Streams[0].Attached)
@ -608,7 +617,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
{ {
sprintf(buff->L2DATA, "%d %s", TNC->Port, &buff->L2DATA[6]); sprintf(buff->L2DATA, "%d %s", TNC->Port, &buff->L2DATA[6]);
if (Rig_Command(TNC->PortRecord->ATTACHEDSESSIONS[0]->L4CROSSLINK->CIRCUITINDEX, buff->L2DATA)) if (Rig_Command(TNC->PortRecord->ATTACHEDSESSIONS[0]->L4CROSSLINK, buff->L2DATA))
{ {
} }
else else
@ -763,10 +772,12 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
if (TNC->CONNECTED) if (TNC->CONNECTED)
{ {
if (TNC->Streams[0].Connected)
VARASendCommand(TNC, "ABORT\r", TRUE);
// GetSemaphore(&Semaphore, 52); // GetSemaphore(&Semaphore, 52);
// VARASendCommand(TNC, "CLOSE", FALSE); // VARASendCommand(TNC, "CLOSE", FALSE);
// FreeSemaphore(&Semaphore); // FreeSemaphore(&Semaphore);
// Sleep(100); Sleep(100);
} }
shutdown(TNC->TCPSock, SD_BOTH); shutdown(TNC->TCPSock, SD_BOTH);
@ -984,12 +995,12 @@ void * VARAExtInit(EXTPORTDATA * PortEntry)
int i, port; int i, port;
char Msg[255]; char Msg[255];
char * ptr; char * ptr;
int line;
APPLCALLS * APPL; APPLCALLS * APPL;
struct TNCINFO * TNC; struct TNCINFO * TNC;
int AuxCount = 0; int AuxCount = 0;
char Appl[11]; char Appl[11];
char * TempScript; char * TempScript;
int line;
struct PORTCONTROL * PORT = &PortEntry->PORTCONTROL; struct PORTCONTROL * PORT = &PortEntry->PORTCONTROL;
// //
// Will be called once for each VARA port // Will be called once for each VARA port
@ -1043,7 +1054,6 @@ void * VARAExtInit(EXTPORTDATA * PortEntry)
TNC->RXRadio = TNC->TXRadio = PortEntry->PORTCONTROL.PORTINTERLOCK; TNC->RXRadio = TNC->TXRadio = PortEntry->PORTCONTROL.PORTINTERLOCK;
PortEntry->PORTCONTROL.PROTOCOL = 10; PortEntry->PORTCONTROL.PROTOCOL = 10;
PortEntry->PORTCONTROL.PORTQUALITY = 0;
PortEntry->MAXHOSTMODESESSIONS = 1; PortEntry->MAXHOSTMODESESSIONS = 1;
PortEntry->SCANCAPABILITIES = SIMPLE; // Scan Control - pending connect only PortEntry->SCANCAPABILITIES = SIMPLE; // Scan Control - pending connect only
@ -1060,6 +1070,19 @@ void * VARAExtInit(EXTPORTDATA * PortEntry)
TNC->ModemCentre = 1500; // WINMOR is always 1500 Offset TNC->ModemCentre = 1500; // WINMOR is always 1500 Offset
if (TNC->NRNeighbour)
{
// NETROM over VARA Link
TNC->NetRomMode = 1;
TNC->LISTENCALLS = MYNETROMCALL;
PORT->PortNoKeepAlive = 1;
TNC->DummyLink = zalloc(sizeof(struct _LINKTABLE));
TNC->DummyLink->LINKPORT = &TNC->PortRecord->PORTCONTROL;
}
else
PORT->PORTQUALITY = 0;
ptr=strchr(TNC->NodeCall, ' '); ptr=strchr(TNC->NodeCall, ' ');
if (ptr) *(ptr) = 0; // Null Terminate if (ptr) *(ptr) = 0; // Null Terminate
@ -1904,7 +1927,7 @@ VOID VARAProcessResponse(struct TNCINFO * TNC, UCHAR * Buffer, int MsgLen)
TNC->HadConnect = TRUE; TNC->HadConnect = TRUE;
if (TNC->PortRecord->ATTACHEDSESSIONS[0] == 0) if (TNC->PortRecord->ATTACHEDSESSIONS[0] == 0 || (TNC->NetRomMode && STREAM->Connecting == 0))
{ {
TRANSPORTENTRY * SESS; TRANSPORTENTRY * SESS;
@ -1916,7 +1939,7 @@ VOID VARAProcessResponse(struct TNCINFO * TNC, UCHAR * Buffer, int MsgLen)
TNC->SessionTimeLimit = TNC->DefaultSessionTimeLimit; // Reset Limit TNC->SessionTimeLimit = TNC->DefaultSessionTimeLimit; // Reset Limit
ProcessIncommingConnectEx(TNC, Call, 0, TRUE, TRUE); ProcessIncommingConnectEx(TNC, Call, 0, (TNC->NetRomMode == 0), TRUE);
SESS = TNC->PortRecord->ATTACHEDSESSIONS[0]; SESS = TNC->PortRecord->ATTACHEDSESSIONS[0];
@ -1961,7 +1984,7 @@ VOID VARAProcessResponse(struct TNCINFO * TNC, UCHAR * Buffer, int MsgLen)
TidyClose(TNC, 0); TidyClose(TNC, 0);
sprintf(Status, "%d SCANSTART 15", TNC->Port); sprintf(Status, "%d SCANSTART 15", TNC->Port);
Rig_Command(-1, Status); Rig_Command((TRANSPORTENTRY *) -1, Status);
Debugprintf("VARA Call from %s rejected", Call); Debugprintf("VARA Call from %s rejected", Call);
return; return;
} }
@ -1986,13 +2009,33 @@ VOID VARAProcessResponse(struct TNCINFO * TNC, UCHAR * Buffer, int MsgLen)
TidyClose(TNC, 0); TidyClose(TNC, 0);
sprintf(Status, "%d SCANSTART 15", TNC->Port); sprintf(Status, "%d SCANSTART 15", TNC->Port);
Rig_Command(-1, Status); Rig_Command((TRANSPORTENTRY *) -1, Status);
Debugprintf("VARA Call from %s not in ValidCalls - rejected", Call); Debugprintf("VARA Call from %s not in ValidCalls - rejected", Call);
return; return;
} }
} }
} }
if (TNC->NetRomMode)
{
// send any queued data
int bytes;
if (TNC->NetRomTxLen)
{
STREAM->PacketsSent++;
bytes = send(TNC->TCPDataSock, TNC->NetRomTxBuffer, TNC->NetRomTxLen, 0);
STREAM->BytesTXed += TNC->NetRomTxLen;
free(TNC->NetRomTxBuffer);
TNC->NetRomTxBuffer = NULL;
TNC->NetRomTxLen = 0;
}
return;
}
// See which application the connect is for // See which application the connect is for
@ -2075,18 +2118,39 @@ VOID VARAProcessResponse(struct TNCINFO * TNC, UCHAR * Buffer, int MsgLen)
char Reply[80]; char Reply[80];
int ReplyLen; int ReplyLen;
if (TNC->NetRomMode)
{
// send any queued data
int bytes;
if (TNC->NetRomTxLen)
{
STREAM->PacketsSent++;
bytes = send(TNC->TCPDataSock, TNC->NetRomTxBuffer, TNC->NetRomTxLen, 0);
STREAM->BytesTXed += TNC->NetRomTxLen;
free(TNC->NetRomTxBuffer);
TNC->NetRomTxBuffer = NULL;
TNC->NetRomTxLen = 0;
}
}
else
{
buffptr = GetBuff(); buffptr = GetBuff();
if (buffptr == 0) if (buffptr == 0)
{
return; // No buffers, so ignore return; // No buffers, so ignore
}
ReplyLen = sprintf(Reply, "*** Connected to %s\r", TNC->TargetCall); ReplyLen = sprintf(Reply, "*** Connected to %s\r", TNC->TargetCall);
buffptr->Len = ReplyLen; buffptr->Len = ReplyLen;
memcpy(buffptr->Data, Reply, ReplyLen); memcpy(buffptr->Data, Reply, ReplyLen);
C_Q_ADD(&TNC->WINMORtoBPQ_Q, buffptr); C_Q_ADD(&TNC->WINMORtoBPQ_Q, buffptr);
}
TNC->Streams[0].Connecting = FALSE; TNC->Streams[0].Connecting = FALSE;
TNC->Streams[0].Connected = TRUE; // Subsequent data to data channel TNC->Streams[0].Connected = TRUE; // Subsequent data to data channel
@ -2239,11 +2303,13 @@ VOID VARAProcessResponse(struct TNCINFO * TNC, UCHAR * Buffer, int MsgLen)
C_Q_ADD(&TNC->WINMORtoBPQ_Q, buffptr); C_Q_ADD(&TNC->WINMORtoBPQ_Q, buffptr);
} }
VOID VARAProcessReceivedData(struct TNCINFO * TNC) VOID VARAProcessReceivedData(struct TNCINFO * TNC)
{ {
int InputLen; int InputLen;
InputLen = recv(TNC->TCPDataSock, TNC->ARDOPDataBuffer, 8192, 0); InputLen = recv(TNC->TCPDataSock, &TNC->ARDOPDataBuffer[TNC->DataInputLen], 8192 - TNC->DataInputLen, 0);
if (InputLen == 0 || InputLen == SOCKET_ERROR) if (InputLen == 0 || InputLen == SOCKET_ERROR)
{ {
@ -2265,18 +2331,159 @@ VOID VARAProcessReceivedData(struct TNCINFO * TNC)
TNC->Streams[0].Disconnecting = FALSE; TNC->Streams[0].Disconnecting = FALSE;
closesocket(TNC->TCPDataSock); closesocket(TNC->TCPDataSock);
TNC->TCPSock = 0; TNC->TCPSock = 0;
return; return;
} }
TNC->DataInputLen += InputLen; TNC->DataInputLen += InputLen;
if (TNC->NetRomMode)
{
// Unpack KISS frames from data stream
unsigned char c;
int n = 0;
int Len = TNC->DataInputLen;
unsigned char KISSBuffer[600];
int KissLen = 0;
while (Len)
{
Len--;
c = TNC->ARDOPDataBuffer[n++];
if (TNC->ESCFLAG)
{
//
// FESC received - next should be TFESC or TFEND
TNC->ESCFLAG = FALSE;
if (c == TFESC)
c = FESC;
if (c == TFEND)
c = FEND;
}
else
{
switch (c)
{
case FEND:
//
// Either start of message or message complete
//
if (KissLen == 0)
{
// Start of Message.
continue;
}
// Have a complete KISS frame - remove from buffer and process
if (KISSBuffer[0] == 255)
{
// NODE Message
MESSAGE * Msg = GetBuff();
if (Msg)
{
// Set up header
Msg->LENGTH = KissLen + (Msg->L2DATA - (unsigned char *)Msg);
memcpy(Msg->L2DATA, KISSBuffer, KissLen);
ConvToAX25(TNC->NRNeighbour, Msg->ORIGIN);
memcpy(Msg->DEST, NETROMCALL, 7);
PROCESSNODEMESSAGE(Msg, &TNC->PortRecord->PORTCONTROL);
Msg->PID = 0xcf;
Msg->PORT = TNC->Port | 0x80;
Msg->CTL = 3;
Msg->ORIGIN[6] |= 1; // set end of address
time(&Msg->Timestamp);
BPQTRACE(Msg, FALSE);
}
}
else
{
// Netrom Message
L3MESSAGEBUFFER * L3MSG = GetBuff();
MESSAGE * Buffer = GetBuff();
if (L3MSG)
{
// Set up header
L3MSG->LENGTH = KissLen + (L3MSG->L3SRCE - (unsigned char *)L3MSG);
memcpy(L3MSG->L3SRCE, KISSBuffer, KissLen);
L3MSG->L3PID = 0xcf;
// Create copy to pass to monitor
// To trace we need to reformat as MESSAGE
Buffer->PID = 0xcf;
Buffer->PORT = TNC->Port;
Buffer->CTL = 3;
Buffer->LENGTH = KissLen + (Buffer->L2DATA - (unsigned char *)Buffer);
memcpy(Buffer->L2DATA, KISSBuffer, KissLen);
ConvToAX25(TNC->NRNeighbour, Buffer->DEST);
memcpy(Buffer->ORIGIN, NETROMCALL, 7);
Buffer->ORIGIN[6] |= 1; // set end of address
time(&Buffer->Timestamp);
BPQTRACE(Buffer, FALSE); // TRACE
NETROMMSG(TNC->DummyLink, L3MSG);
}
}
if (Len == 0) // All used
{
TNC->DataInputLen = 0;
}
else
{
memmove(TNC->ARDOPDataBuffer, &TNC->ARDOPDataBuffer[n], Len);
TNC->DataInputLen = Len;
KissLen = 0;
n = 0;
}
continue;
case FESC:
TNC->ESCFLAG = TRUE;
continue;
}
}
// Ok, a normal char
KISSBuffer[KissLen++] = c;
if (KissLen > 590)
KissLen = 0;
}
// End of input - if there is stuff left in the input buffer we will add the next block to it
return;
}
VARAProcessDataPacket(TNC, TNC->ARDOPDataBuffer, TNC->DataInputLen); VARAProcessDataPacket(TNC, TNC->ARDOPDataBuffer, TNC->DataInputLen);
TNC->DataInputLen=0; TNC->DataInputLen = 0;
return; return;
} }
@ -2303,6 +2510,8 @@ VOID VARAProcessReceivedControl(struct TNCINFO * TNC)
TNC->TCPSock = 0; TNC->TCPSock = 0;
TNC->CONNECTED = FALSE; TNC->CONNECTED = FALSE;
if (TNC->Streams[0].Connecting || TNC->Streams[0].Connected)
TNC->Streams[0].ReportDISC = TRUE; TNC->Streams[0].ReportDISC = TRUE;
TNC->Streams[0].Disconnecting = FALSE; TNC->Streams[0].Disconnecting = FALSE;
@ -2434,23 +2643,6 @@ static VOID CloseComplete(struct TNCINFO * TNC, int Stream)
else if (TNC->DefaultMode == 54) else if (TNC->DefaultMode == 54)
VARASendCommand(TNC, "BW2750\r", TRUE); VARASendCommand(TNC, "BW2750\r", TRUE);
// If a default frequency is specified, set it
if (TNC->DefaultTXFreq && TNC->TXRadio)
{
char Msg[128];
sprintf(Msg, "R%d %f", TNC->TXRadio, TNC->DefaultTXFreq);
Rig_Command(-1, Msg);
}
if (TNC->DefaultRXFreq && TNC->RXRadio && TNC->TXRadio != TNC->RXRadio)
{
char Msg[128];
sprintf(Msg, "R%d %f", TNC->RXRadio, TNC->DefaultRXFreq);
Rig_Command(-1, Msg);
}
} }
@ -2555,15 +2747,147 @@ VOID VARAReleaseTNC(struct TNCINFO * TNC)
if (TNC->DefaultRadioCmd) if (TNC->DefaultRadioCmd)
{ {
sprintf(TXMsg, "%d %s", TNC->Port, TNC->DefaultRadioCmd); sprintf(TXMsg, "%d %s", TNC->Port, TNC->DefaultRadioCmd);
Rig_Command(-1, TXMsg); Rig_Command( (TRANSPORTENTRY *) -1, TXMsg);
} }
sprintf(TXMsg, "%d SCANSTART 15", TNC->Port); sprintf(TXMsg, "%d SCANSTART 15", TNC->Port);
Rig_Command(-1, TXMsg); Rig_Command( (TRANSPORTENTRY *) -1, TXMsg);
ReleaseOtherPorts(TNC); ReleaseOtherPorts(TNC);
} }
void SendVARANetrom(struct TNCINFO * TNC, unsigned char * Data, int Len)
{
// Check that PID is 0xcf, then just send the data portion of packet
// We need to delimit packets, and KISS encoding seems as good as any. Also
// need to buffer to avoid sending lots of small packets and maybe to wait for
// link to connect
unsigned char Kiss[600];
int KissLen;
struct STREAMINFO * STREAM = &TNC->Streams[0];
if (TNC->CONNECTED == 0)
return; // Don't Queue if no connection to TNC
KissLen = KissEncode(Data, Kiss, Len);
TNC->NetRomTxBuffer = realloc(TNC->NetRomTxBuffer, TNC->NetRomTxLen + KissLen);
memcpy(&TNC->NetRomTxBuffer[TNC->NetRomTxLen], Kiss, KissLen);
TNC->NetRomTxLen += KissLen;
if (STREAM->Connected)
{
int bytes;
STREAM->PacketsSent++;
bytes = send(TNC->TCPDataSock, TNC->NetRomTxBuffer, TNC->NetRomTxLen, 0);
STREAM->BytesTXed += TNC->NetRomTxLen;
free(TNC->NetRomTxBuffer);
TNC->NetRomTxBuffer = NULL;
TNC->NetRomTxLen = 0;
return;
}
if (TNC->Streams[0].Connecting == 0 && TNC->Streams[0].Connected == 0)
{
// Try to connect to Neighbour
char Connect[32];
TNC->NetRomMode = 1;
sprintf(Connect, "CONNECT %s %s\r", MYNETROMCALL, TNC->NRNeighbour);
// Need to set connecting here as if we delay for busy we may incorrectly process OK response
TNC->Streams[0].Connecting = TRUE;
// See if Busy
if (InterlockedCheckBusy(TNC))
{
// Channel Busy. Unless override set, wait
if (TNC->OverrideBusy == 0)
{
// Save Command, and wait up to 10 secs
sprintf(TNC->WEB_TNCSTATE, "Waiting for clear channel");
MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
TNC->ConnectCmd = _strdup(Connect);
TNC->BusyDelay = TNC->BusyWait * 10; // BusyWait secs
return;
}
}
TNC->OverrideBusy = FALSE;
VARASendCommand(TNC, Connect, TRUE);
TNC->Streams[0].ConnectTime = time(NULL);
memset(TNC->Streams[0].RemoteCall, 0, 10);
strcpy(TNC->Streams[0].RemoteCall, MYNETROMCALL);
sprintf(TNC->WEB_TNCSTATE, "%s Connecting to %s", TNC->Streams[0].MyCall, TNC->Streams[0].RemoteCall);
MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
}
}
void SendVARANetromNodes(struct TNCINFO * TNC, MESSAGE *Buffer)
{
// Check that PID is 0xcf, then just send the data portion of packet
int Len = Buffer->LENGTH - (Buffer->L2DATA - (unsigned char *)Buffer);
if (Buffer->PID != 0xcf)
{
ReleaseBuffer(Buffer);
return;
}
SendVARANetrom(TNC, Buffer->L2DATA, Len);
time(&Buffer->Timestamp);
C_Q_ADD(&TRACE_Q, Buffer);
}
void SendVARANetromMsg(struct TNCINFO * TNC, L3MESSAGEBUFFER * MSG)
{
MESSAGE * Buffer = (MESSAGE *)MSG;
int Len = MSG->LENGTH - (MSG->L3SRCE - (unsigned char *)MSG);
if (MSG->L3PID != 0xcf)
{
ReleaseBuffer(MSG);
return;
}
SendVARANetrom(TNC, MSG->L3SRCE, Len);
memmove(Buffer->L2DATA, MSG->L3SRCE, Len);
// To trace we need to reformat as MESSAGE
Buffer->PID = 0xcf;
Buffer->PORT = TNC->Port | 0x80;
Buffer->CTL = 3;
Buffer->LENGTH = Len + (Buffer->L2DATA - (unsigned char *)Buffer);
ConvToAX25(TNC->NRNeighbour, Buffer->DEST);
memcpy(Buffer->ORIGIN, NETROMCALL, 7);
Buffer->ORIGIN[6] |= 1; // set end of address
time(&Buffer->Timestamp);
C_Q_ADD(&TRACE_Q, Buffer);
}

View File

@ -10,8 +10,8 @@
#endif #endif
#define KVers 6,0,23,59 #define KVers 6,0,23,66
#define KVerstring "6.0.23.59\0" #define KVerstring "6.0.23.66\0"
#ifdef CKernel #ifdef CKernel

View File

@ -803,7 +803,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
sprintf(Msg, "%d SCANSTOP", TNC->Port); sprintf(Msg, "%d SCANSTOP", TNC->Port);
Rig_Command(-1, Msg); Rig_Command( (TRANSPORTENTRY *) -1, Msg);
} }
@ -992,7 +992,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
{ {
sprintf(&buff->L2DATA[0], "%d %s", TNC->Port, &buff->L2DATA[6]); sprintf(&buff->L2DATA[0], "%d %s", TNC->Port, &buff->L2DATA[6]);
if (Rig_Command(TNC->PortRecord->ATTACHEDSESSIONS[0]->L4CROSSLINK->CIRCUITINDEX, &buff->L2DATA[0])) if (Rig_Command(TNC->PortRecord->ATTACHEDSESSIONS[0]->L4CROSSLINK, &buff->L2DATA[0]))
{ {
} }
else else
@ -1327,7 +1327,7 @@ VOID ReleaseTNC(struct TNCINFO * TNC)
sprintf(TXMsg, "%d SCANSTART 15", TNC->Port); sprintf(TXMsg, "%d SCANSTART 15", TNC->Port);
Rig_Command(-1, TXMsg); Rig_Command( (TRANSPORTENTRY *) -1, TXMsg);
ReleaseOtherPorts(TNC); ReleaseOtherPorts(TNC);
@ -2176,7 +2176,7 @@ VOID ProcessResponse(struct TNCINFO * TNC, UCHAR * Buffer, int MsgLen)
TidyClose(TNC, 0); TidyClose(TNC, 0);
sprintf(Status, "%d SCANSTART 15", TNC->Port); sprintf(Status, "%d SCANSTART 15", TNC->Port);
Rig_Command(-1, Status); Rig_Command( (TRANSPORTENTRY *) -1, Status);
Debugprintf("WINMOR Call from %s rejected", Call); Debugprintf("WINMOR Call from %s rejected", Call);
return; return;
} }
@ -2201,7 +2201,7 @@ VOID ProcessResponse(struct TNCINFO * TNC, UCHAR * Buffer, int MsgLen)
TidyClose(TNC, 0); TidyClose(TNC, 0);
sprintf(Status, "%d SCANSTART 15", TNC->Port); sprintf(Status, "%d SCANSTART 15", TNC->Port);
Rig_Command(-1, Status); Rig_Command( (TRANSPORTENTRY *) -1, Status);
Debugprintf("WINMOR Call from %s not in ValidCalls - rejected", Call); Debugprintf("WINMOR Call from %s not in ValidCalls - rejected", Call);
return; return;
} }

View File

@ -324,6 +324,9 @@ typedef struct ConnectionInfo_S
#define WINLINKRO 0x020000 // WL2K RO (no J in SID) #define WINLINKRO 0x020000 // WL2K RO (no J in SID)
#define SYNCMODE 0x040000 // RMS RELAY SYNC #define SYNCMODE 0x040000 // RMS RELAY SYNC
#define MFJMODE 0x080000 // MFJ PMS #define MFJMODE 0x080000 // MFJ PMS
#define NEWPACCOM 0x100000 // PACCOM PMS 3.2
#define SETCALLTOSENDER 0x200000 // Set calling call to message sender
struct FBBRestartData struct FBBRestartData
{ {

30
cMain.c
View File

@ -428,7 +428,33 @@ Loop:
if (Session) if (Session)
{ {
struct TNCINFO * TNC = PORTVEC->PORTCONTROL.TNC;
CloseSessionPartner(Session); CloseSessionPartner(Session);
// is this the place to run DisconnectScript?
if (TNC->DisconnectScript)
{
int n = 0;
char command[256];
struct DATAMESSAGE * Buffer;
TRANSPORTENTRY Session = {0}; // = TNC->PortRecord->ATTACHEDSESSIONS[Sessno];
while (TNC->DisconnectScript[n])
{
Buffer = GetBuff();
if (Buffer)
{
Session.Secure_Session = 1;
Session.CIRCUITINDEX = -1;
Buffer->LENGTH = sprintf(Buffer->L2DATA, "%s\r", TNC->DisconnectScript[n++]) + (sizeof(void *) + 4);
CommandHandler(&Session, Buffer);
};
}
}
PORTVEC->ATTACHEDSESSIONS[Sessno] = NULL; PORTVEC->ATTACHEDSESSIONS[Sessno] = NULL;
} }
return; return;
@ -698,9 +724,11 @@ BOOL Start()
// if NETROMCALL Defined, use it // if NETROMCALL Defined, use it
if (cfg->C_NETROMCALL[0]) if (cfg->C_NETROMCALL[0] && cfg->C_NETROMCALL[0] != ' ')
memcpy(MYNETROMCALL, cfg->C_NETROMCALL, 10); memcpy(MYNETROMCALL, cfg->C_NETROMCALL, 10);
strlop(MYNETROMCALL, ' ');
APPLCALLTABLE[0].APPLQUAL = BBSQUAL; APPLCALLTABLE[0].APPLQUAL = BBSQUAL;
if (cfg->C_WASUNPROTO == 0 && cfg->C_BTEXT) if (cfg->C_WASUNPROTO == 0 && cfg->C_BTEXT)

View File

@ -2,7 +2,7 @@ Chat :
{ {
ApplNum = 2; ApplNum = 2;
MaxStreams = 11; MaxStreams = 11;
OtherChatNodes = "\r\n"; OtherChatNodes = "RDGCHT:GB7RDG-1|C STHGTE|C 1 MB7NCR-2|C RDGCHT\r\nRDGCHT:GB7RDG-1|C STHGTE|C 1 MB7NCR-2|C RDGCHT\r\n\r\n";
ChatWelcomeMsg = "G8BPQ Chat Server.$WType /h for command summary.$WBringing up links to other nodes.$WThis may take a minute or two.$WThe /p command shows what nodes are linked.$W"; ChatWelcomeMsg = "G8BPQ Chat Server.$WType /h for command summary.$WBringing up links to other nodes.$WThis may take a minute or two.$WThe /p command shows what nodes are linked.$W";
MapPosition = "MapPosition=5259.04N, 00107.01W"; MapPosition = "MapPosition=5259.04N, 00107.01W";
MapPopup = "MapPopup=G8BPQ Nottingham<p><a href=\"http://www.g8bpq.org.uk\">BPQ32 Home Page</a"; MapPopup = "MapPopup=G8BPQ Nottingham<p><a href=\"http://www.g8bpq.org.uk\">BPQ32 Home Page</a";
@ -17,6 +17,6 @@ Chat :
ConsoleSize = "821,1629,283,893"; ConsoleSize = "821,1629,283,893";
MonitorSize = "828,1644,148,770"; MonitorSize = "828,1644,148,770";
DebugSize = "0,0,0,0"; DebugSize = "0,0,0,0";
WindowSize = "714,1318,165,513"; WindowSize = "231,835,254,602";
Version = "6,0,23,28"; Version = "6,0,23,59";
}; };

View File

@ -528,6 +528,13 @@ BOOL ProcessConfig()
GetNextLine(rec); GetNextLine(rec);
} }
if (xxcfg.C_NODECALL[0] == ' ')
{
Consoleprintf("Missing NODECALL");
heading = 1;
}
paramok[6]=1; /* dont need BUFFERS */ paramok[6]=1; /* dont need BUFFERS */
paramok[8]=1; /* dont need TRANSDELAY */ paramok[8]=1; /* dont need TRANSDELAY */
paramok[13]=1; // NodeAlias paramok[13]=1; // NodeAlias

View File

@ -26,7 +26,7 @@ along with LinBPQ/BPQ32. If not, see http://www.gnu.org/licenses
TRANSPORTENTRY * L4TABLE = 0; TRANSPORTENTRY * L4TABLE = 0;
UCHAR NEXTID = 55; UCHAR NEXTID = 55;
int MAXCIRCUITS = 50; int MAXCIRCUITS = 50;
int L4DEFAULTWINDOW = 4; int L4DEFAULTWINDOW = 8;
int L4T1 = 60; int L4T1 = 60;
APPLCALLS APPLCALLTABLE[NumberofAppls]; APPLCALLS APPLCALLTABLE[NumberofAppls];
char * APPLS; char * APPLS;

39
makefile_mac Normal file
View File

@ -0,0 +1,39 @@
# LinBPQ Makefile
# To exclude i2c support run make noi2c
OBJS = pngwtran.o pngrtran.o pngset.o pngrio.o pngwio.o pngtrans.o pngrutil.o pngwutil.o\
pngread.o pngwrite.o png.o pngerror.o pngget.o pngmem.o APRSIconData.o AISCommon.o\
upnp.o APRSStdPages.o HSMODEM.o WinRPR.o KISSHF.o TNCEmulators.o bpqhdlc.o SerialPort.o\
adif.o WebMail.o utf8Routines.o VARA.o LzFind.o Alloc.o LzmaDec.o LzmaEnc.o LzmaLib.o \
Multicast.o ARDOP.o IPCode.o FLDigi.o linether.o CMSAuth.o APRSCode.o BPQtoAGW.o KAMPactor.o\
AEAPactor.o HALDriver.o MULTIPSK.o BBSHTMLConfig.o ChatHTMLConfig.o BBSUtilities.o bpqaxip.o\
BPQINP3.o BPQNRR.o cMain.o Cmd.o CommonCode.o HTMLCommonCode.o compatbits.o config.o datadefs.o \
FBBRoutines.o HFCommon.o Housekeeping.o HTTPcode.o kiss.o L2Code.o L3Code.o L4Code.o lzhuf32.o \
MailCommands.o MailDataDefs.o LinBPQ.o MailRouting.o MailTCP.o MBLRoutines.o md5.o Moncode.o \
NNTPRoutines.o RigControl.o TelnetV6.o WINMOR.o TNCCode.o UZ7HODrv.o WPRoutines.o \
SCSTrackeMulti.o SCSPactor.o SCSTracker.o HanksRT.o UIRoutines.o AGWAPI.o AGWMoncode.o \
DRATS.o FreeDATA.o base64.o Events.o
# Configuration:
CC = gcc
all: CFLAGS = -DLINBPQ -DMACBPQ -MMD -g -fcommon
all: linbpq
noi2c: CFLAGS = -DLINBPQ -MMD -DNOI2C -g
noi2c: linbpq
linbpq: $(OBJS)
gcc $(OBJS) -Xlinker -lminiupnpc -liconv -lm -lz -lpthread -lconfig -lpcap -o linbpq
cp linbpq ../linbpq/linbpq.new
-include *.d
clean :
rm *.d
rm linbpq $(OBJS)

View File

@ -195,6 +195,7 @@ struct RIGINFO
#define FT991A 15 // 991A is a varient of FT2000 but easier to have own type #define FT991A 15 // 991A is a varient of FT2000 but easier to have own type
#define RTLUDP 16 #define RTLUDP 16
#define FLRIG 17 #define FLRIG 17
#define SDRRADIO 18
// Yease seem to have lots of variants of the same model // Yease seem to have lots of variants of the same model

View File

@ -473,9 +473,9 @@ typedef struct TNCINFO
UCHAR * ARDOPBuffer; // Needs to be pretty big, so Malloc UCHAR * ARDOPBuffer; // Needs to be pretty big, so Malloc
UCHAR * ARDOPDataBuffer; // Needs to be pretty big, so Malloc UCHAR * ARDOPDataBuffer; // Needs to be pretty big, so Malloc
int InputLen; // Data we have alreasdy = Offset of end of an incomplete packet; int InputLen; // Data we have already = Offset of end of an incomplete packet;
int DataInputLen; // Data we have alreasdy = Offset of end of an incomplete packet; int DataInputLen; // Data we have already = Offset of end of an incomplete packet;
int KISSInputLen; // Data we have alreasdy = Offset of end of an incomplete packet; int KISSInputLen; // Data we have already = Offset of end of an incomplete packet;
int ESCFLAG; // KISS Escape received int ESCFLAG; // KISS Escape received
int MSGCOUNT; // DED WORKING FIELD int MSGCOUNT; // DED WORKING FIELD
@ -544,6 +544,7 @@ typedef struct TNCINFO
double DefaultTXFreq; // Freq to set on tx after close double DefaultTXFreq; // Freq to set on tx after close
double DefaultRXFreq; // Freq to set on rx after close double DefaultRXFreq; // Freq to set on rx after close
char ** DisconnectScript; // May replace above 2 params
int TXOffset; // Correction to TXFreq int TXOffset; // Correction to TXFreq
@ -822,6 +823,13 @@ typedef struct TNCINFO
double SNR; // S/N Ratio (VARA) double SNR; // S/N Ratio (VARA)
int NetRomMode;
unsigned char * NetRomTxBuffer; // For Netrom over VARA
int NetRomTxLen;
char * NRNeighbour;
int NRCloseTimer;
struct _LINKTABLE * DummyLink; // Simulated link to simplify interface to ax,25 netrom code
} *PTNCINFO; } *PTNCINFO;
VOID * zalloc(int len); VOID * zalloc(int len);
@ -865,7 +873,7 @@ extern BOOL MinimizetoTray;
int standardParams(struct TNCINFO * TNC, char * buf); int standardParams(struct TNCINFO * TNC, char * buf);
void DecodePTTString(struct TNCINFO * TNC, char * ptr); void DecodePTTString(struct TNCINFO * TNC, char * ptr);
int Rig_Command(int Session, char * Command); int Rig_Command(TRANSPORTENTRY * Session, char * Command);
BOOL Rig_Poll(); BOOL Rig_Poll();