summaryrefslogtreecommitdiff
path: root/CommonCode.c
diff options
context:
space:
mode:
authorDave Hibberd <hibby@debian.org>2024-11-05 21:03:15 +0000
committerDave Hibberd <hibby@debian.org>2024-11-05 21:03:15 +0000
commit424c0bd3e14d3ddda6c2d945b6465d51c462c76b (patch)
tree80b44cbe3f5fc19de1c057e37c761a95a0518a44 /CommonCode.c
parenteb0d36d3f67be13de74023adb6d30362d47805fe (diff)
New upstream version 6.0.24.49upstream/6.0.24.49
Diffstat (limited to 'CommonCode.c')
-rw-r--r--CommonCode.c34
1 files changed, 15 insertions, 19 deletions
diff --git a/CommonCode.c b/CommonCode.c
index 1b6352f..a392b17 100644
--- a/CommonCode.c
+++ b/CommonCode.c
@@ -28,6 +28,7 @@ along with LinBPQ/BPQ32. If not, see http://www.gnu.org/licenses
#include <stdlib.h>
#include <string.h>
#include <time.h>
+#include "mqtt.h"
#pragma data_seg("_BPQDATA")
@@ -735,22 +736,7 @@ VOID CheckForDetach(struct TNCINFO * TNC, int Stream, struct STREAMINFO * STREAM
// Create a traffic record
- if (STREAM->Connected && STREAM->ConnectTime)
- {
- Duration = time(NULL) - STREAM->ConnectTime;
-
- if (Duration == 0)
- Duration = 1; // Or will get divide by zero error
-
- sprintf(logmsg,"Port %2d %9s Bytes Sent %d BPS %d Bytes Received %d BPS %d Time %d Seconds",
- TNC->Port, STREAM->RemoteCall,
- STREAM->BytesTXed, (int)(STREAM->BytesTXed/Duration),
- STREAM->BytesRXed, (int)(STREAM->BytesRXed/Duration), (int)Duration);
-
- Debugprintf(logmsg);
-
- STREAM->ConnectTime = 0;
- }
+ hookL4SessionDeleted(TNC, STREAM);
if (STREAM->BPQtoPACTOR_Q) // Still data to send?
return; // Will close when all acked
@@ -920,6 +906,7 @@ BOOL ProcessIncommingConnectEx(struct TNCINFO * TNC, char * Call, int Stream, BO
int Totallen = 0;
UCHAR * ptr;
struct PORTCONTROL * PORT = (struct PORTCONTROL *)TNC->PortRecord;
+ struct STREAMINFO * STREAM = &TNC->Streams[Stream];
// Stop Scanner
@@ -952,7 +939,11 @@ BOOL ProcessIncommingConnectEx(struct TNCINFO * TNC, char * Call, int Stream, BO
memset(Session, 0, sizeof(TRANSPORTENTRY));
- memcpy(TNC->Streams[Stream].RemoteCall, Call, 9); // Save Text Callsign
+ memcpy(STREAM->RemoteCall, Call, 9); // Save Text Callsign
+
+ // May be subsequently rejected but a good place to capture calls
+
+ hookL4SessionAccepted(STREAM, Call, TNC->TargetCall);
if (AllowTR)
ConvToAX25Ex(Call, Session->L4USER); // Allow -T and -R SSID's for MPS
@@ -965,7 +956,7 @@ BOOL ProcessIncommingConnectEx(struct TNCINFO * TNC, char * Call, int Stream, BO
if (NEXTID == 0) NEXTID++; // Keep non-zero
TNC->PortRecord->ATTACHEDSESSIONS[Stream] = Session;
- TNC->Streams[Stream].Attached = TRUE;
+ STREAM->Attached = TRUE;
Session->L4TARGET.EXTPORT = TNC->PortRecord;
@@ -976,7 +967,7 @@ BOOL ProcessIncommingConnectEx(struct TNCINFO * TNC, char * Call, int Stream, BO
Session->SESSPACLEN = TNC->PortRecord->PORTCONTROL.PORTPACLEN;
Session->KAMSESSION = Stream;
- TNC->Streams[Stream].Connected = TRUE; // Subsequent data to data channel
+ STREAM->Connected = TRUE; // Subsequent data to data channel
if (LogAllConnects)
{
@@ -3716,6 +3707,11 @@ VOID OpenReportingSockets()
Chatreportdest.sin_port = htons(81);
_beginthread(ResolveUpdateThread, 0, NULL);
+
+ printf("MQTT Enabled %d\n", MQTT);
+
+ if (MQTT)
+ MQTTConnect(MQTT_HOST, MQTT_PORT, MQTT_USER, MQTT_PASS);
}
VOID WriteMiniDumpThread();