-
Notifications
You must be signed in to change notification settings - Fork 0
/
CHeaders.h
394 lines (279 loc) · 11.4 KB
/
CHeaders.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
//
// Prototypes for BPQ32 Node Functions
//
#define DllImport
#define EXCLUDEBITS
#include "compatbits.h"
#include "asmstrucs.h"
BOOL CheckExcludeList(UCHAR * Call);
Dll int ConvFromAX25(unsigned char * incall,unsigned char * outcall);
Dll BOOL ConvToAX25(unsigned char * callsign, unsigned char * ax25call);
DllExport BOOL ConvToAX25Ex(unsigned char * callsign, unsigned char * ax25call);
int WritetoConsoleLocal(char * buff);
VOID Consoleprintf(const char * format, ...);
VOID FreeConfig();
int GetListeningPortsPID(int Port);
UINT InitializeExtDriver(PEXTPORTDATA PORTVEC);
VOID PutLengthinBuffer(UCHAR * buff, int datalen); // Neded for arm5 portability
int GetLengthfromBuffer(UCHAR * buff);
#define GetBuff() _GetBuff(__FILE__, __LINE__)
#define ReleaseBuffer(s) _ReleaseBuffer(s, __FILE__, __LINE__)
#define Q_REM(s) _Q_REM(s, __FILE__, __LINE__)
#define C_Q_ADD(s, b) _C_Q_ADD(s, b, __FILE__, __LINE__)
VOID * _Q_REM(VOID *Q, char * File, int Line);
int _C_Q_ADD(VOID *Q, VOID *BUFF, char * File, int Line);
UINT _ReleaseBuffer(VOID *BUFF, char * File, int Line);
VOID * _GetBuff(char * File, int Line);
int _C_Q_ADD(VOID *PQ, VOID *PBUFF, char * File, int Line);
int C_Q_COUNT(VOID *Q);
DllExport char * APIENTRY GetApplCall(int Appl);
DllExport char * APIENTRY GetApplAlias(int Appl);
DllExport int APIENTRY FindFreeStream();
DllExport int APIENTRY DeallocateStream(int stream);
DllExport int APIENTRY SessionState(int stream, int * state, int * change);
DllExport int APIENTRY SetAppl(int stream, int flags, int mask);
DllExport int APIENTRY GetMsg(int stream, char * msg, int * len, int * count );
DllExport int APIENTRY GetConnectionInfo(int stream, char * callsign,
int * port, int * sesstype, int * paclen,
int * maxframe, int * l4window);
struct config_setting_t;
int GetIntValue(struct config_setting_t * group, char * name);
BOOL GetStringValue(struct config_setting_t * group, char * name, char * value);
VOID SaveIntValue(struct config_setting_t * group, char * name, int value);
VOID SaveStringValue(struct config_setting_t * group, char * name, char * value);
int EncryptPass(char * Pass, char * Encrypt);
VOID DecryptPass(char * Encrypt, unsigned char * Pass, unsigned int len);
Dll VOID APIENTRY CreateOneTimePassword(char * Password, char * KeyPhrase, int TimeOffset);
Dll BOOL APIENTRY CheckOneTimePassword(char * Password, char * KeyPhrase);
DllExport int APIENTRY TXCount(int stream);
DllExport int APIENTRY RXCount(int stream);
DllExport int APIENTRY MONCount(int stream);
VOID ReadNodes();
int BPQTRACE(MESSAGE * Msg, BOOL APRS);
VOID CommandHandler(TRANSPORTENTRY * Session, struct DATAMESSAGE * Buffer);
VOID PostStateChange(TRANSPORTENTRY * Session);
VOID InnerCommandHandler(TRANSPORTENTRY * Session, struct DATAMESSAGE * Buffer);
VOID DoTheCommand(TRANSPORTENTRY * Session);
char * MOVEANDCHECK(TRANSPORTENTRY * Session, char * Bufferptr, char * Source, int Len);
VOID DISPLAYCIRCUIT(TRANSPORTENTRY * L4, char * Buffer);
char * FormatUptime(int Uptime);
char * strlop(char * buf, char delim);
BOOL CompareCalls(UCHAR * c1, UCHAR * c2);
VOID PostDataAvailable(TRANSPORTENTRY * Session);
int WritetoConsoleLocal(char * buff);
char * CHECKBUFFER(TRANSPORTENTRY * Session, char * Bufferptr);
VOID CLOSECURRENTSESSION(TRANSPORTENTRY * Session);
VOID SendCommandReply(TRANSPORTENTRY * Session, struct DATAMESSAGE * Buffer, int Len);
struct PORTCONTROL * APIENTRY GetPortTableEntryFromPortNum(int portnum);
int cCOUNT_AT_L2(struct _LINKTABLE * LINK);
VOID SENDL4CONNECT(TRANSPORTENTRY * Session);
VOID CloseSessionPartner(TRANSPORTENTRY * Session);
int COUNTNODES();
int DecodeNodeName(char * NodeName, char * ptr);;
VOID DISPLAYCIRCUIT(TRANSPORTENTRY * L4, char * Buffer);
int cCOUNT_AT_L2(struct _LINKTABLE * LINK);
void * zalloc(int len);
BOOL FindDestination(UCHAR * Call, struct DEST_LIST ** REQDEST);
char * FormatAPRSMH(APRSSTATIONRECORD * MH);
BOOL ProcessConfig();
VOID PUT_ON_PORT_Q(struct PORTCONTROL * PORT, MESSAGE * Buffer);
VOID CLEAROUTLINK(struct _LINKTABLE * LINK);
VOID TellINP3LinkGone(struct ROUTE * Route);
VOID CLEARACTIVEROUTE(struct ROUTE * ROUTE, int Reason);
// Reason Equates
#define NORMALCLOSE 0
#define RETRIEDOUT 1
#define SETUPFAILED 2
#define LINKLOST 3
#define LINKSTUCK 4
int COUNT_AT_L2(struct _LINKTABLE * LINK);
VOID SENDIDMSG();
VOID SENDBTMSG();
VOID INP3TIMER();
VOID REMOVENODE(dest_list * DEST);
BOOL ACTIVATE_DEST(struct DEST_LIST * DEST);
VOID TellINP3LinkSetupFailed(struct ROUTE * Route);
BOOL FindNeighbour(UCHAR * Call, int Port, struct ROUTE ** REQROUTE);
VOID PROCROUTES(struct DEST_LIST * DEST, struct ROUTE * ROUTE, int Qual);
BOOL L2SETUPCROSSLINK(PROUTE ROUTE);
VOID REMOVENODE(dest_list * DEST);
char * SetupNodeHeader(struct DATAMESSAGE * Buffer);
VOID L4CONNECTFAILED(TRANSPORTENTRY * L4);
int CountFramesQueuedOnSession(TRANSPORTENTRY * Session);
VOID CLEARSESSIONENTRY(TRANSPORTENTRY * Session);
VOID __cdecl Debugprintf(const char * format, ...);
int APIENTRY Restart();
int APIENTRY Reboot();
int APIENTRY Reconfig();
Dll int APIENTRY SaveNodes ();
struct SEM;
void GetSemaphore(struct SEM * Semaphore, int ID);
void FreeSemaphore(struct SEM * Semaphore);
void MySetWindowText(HWND hWnd, char * Msg);
Dll int APIENTRY SessionControl(int stream, int command, int Mask);
HANDLE OpenCOMPort(VOID * pPort, int speed, BOOL SetDTR, BOOL SetRTS, BOOL Quiet, int Stopbits);
int ReadCOMBlock(HANDLE fd, char * Block, int MaxLength);
BOOL WriteCOMBlock(HANDLE fd, char * Block, int BytesToWrite);
VOID CloseCOMPort(HANDLE fd);
VOID initUTF8();
int Is8Bit(unsigned char *cpt, int len);
int WebIsUTF8(unsigned char *ptr, int len);
int IsUTF8(unsigned char *ptr, int len);
int Convert437toUTF8(unsigned char * MsgPtr, int len, unsigned char * UTF);
int Convert1251toUTF8(unsigned char * MsgPtr, int len, unsigned char * UTF);
int Convert1252toUTF8(unsigned char * MsgPtr, int len, unsigned char * UTF);
int TrytoGuessCode(unsigned char * Char, int Len);
#define CMD_TO_APPL 1 // PASS COMMAND TO APPLICATION
#define MSG_TO_USER 2 // SEND 'CONNECTED' TO USER
#define MSG_TO_APPL 4 // SEND 'CONECTED' TO APPL
#define UI 3
#define SABM 0x2F
#define DISC 0x43
#define DM 0x0F
#define UA 0x63
#define FRMR 0x87
#define RR 1
#define RNR 5
#define REJ 9
// V2.2 Types
#define SREJ 0x0D
#define SABME 0x6F
#define XID 0xAF
#define TEST 0xE3
#define SUPPORT2point2 1
// XID Optional Functions
#define OPMustHave 0x02A080 // Sync TEST 16 bit FCS Extended Address
#define OPSREJ 4
#define OPSREJMult 0x200000
#define OPREJ 2
#define OPMod8 0x400
#define OPMod128 0x800
#define BPQHOSTSTREAMS 64
extern TRANSPORTENTRY * L4TABLE;
extern unsigned char NEXTID;
extern int MAXCIRCUITS;
extern int L4DEFAULTWINDOW;
extern int L4T1;
extern APPLCALLS APPLCALLTABLE[];
extern char * APPLS;
extern int NEEDMH;
extern int RFOnly;
extern char SESSIONHDDR[];
extern UCHAR NEXTID;
extern struct ROUTE * NEIGHBOURS;
extern int MAXNEIGHBOURS;
extern struct ROUTE * NEIGHBOURS;
extern int ROUTE_LEN;
extern int MAXNEIGHBOURS;
extern struct DEST_LIST * DESTS; // NODE LIST
extern struct DEST_LIST * ENDDESTLIST;
extern int DEST_LIST_LEN;
extern int MAXDESTS; // MAX NODES IN SYSTEM
extern struct _LINKTABLE * LINKS;
extern int LINK_TABLE_LEN;
extern int MAXLINKS;
extern char MYCALL[]; // DB 7 DUP (0) ; NODE CALLSIGN (BIT SHIFTED)
extern char MYALIASTEXT[]; // {" " ; NODE ALIAS (KEEP TOGETHER)
extern UCHAR MYCALLWITHALIAS[13];
extern APPLCALLS APPLCALLTABLE[NumberofAppls];
extern UCHAR MYNODECALL[]; // NODE CALLSIGN (ASCII)
extern UCHAR MYNETROMCALL[]; // NETROM CALLSIGN (ASCII)
extern UCHAR NETROMCALL[]; // NETORM CALL (AX25)
extern UINT FREE_Q;
extern struct PORTCONTROL * PORTTABLE;
extern int NUMBEROFPORTS;
extern int OBSINIT; // INITIAL OBSOLESCENCE VALUE
extern int OBSMIN; // MINIMUM TO BROADCAST
extern int L3INTERVAL; // "NODES" INTERVAL IN MINS
extern int IDINTERVAL; // "ID" BROADCAST INTERVAL
extern int BTINTERVAL; // "BT" BROADCAST INTERVAL
extern int MINQUAL; // MIN QUALITY FOR AUTOUPDATES
extern int HIDENODES; // N * COMMAND SWITCH
extern int BBSQUAL; // QUALITY OF BBS RELATIVE TO NODE
extern int NUMBEROFBUFFERS; // PACKET BUFFERS
extern int PACLEN; //MAX PACKET SIZE
// L2 SYSTEM TIMER RUNS AT 3 HZ
extern int T3; // LINK VALIDATION TIMER (3 MINS) (+ a bit to reduce RR collisions)
extern int L2KILLTIME; // IDLE LINK TIMER (16 MINS)
extern int L3LIVES; // MAX L3 HOPS
extern int L4N2; // LEVEL 4 RETRY COUNT
extern int L4LIMIT; // IDLE SESSION LIMIT - 15 MINS
extern int L4DELAY; // L4 DELAYED ACK TIMER
extern int BBS; // INCLUDE BBS SUPPORT
extern int NODE; // INCLUDE SWITCH SUPPORT
extern int FULL_CTEXT; // CTEXT ON ALL CONNECTS IF NZ
// Although externally streams are numbered 1 to 64, internally offsets are 0 - 63
extern BPQVECSTRUC DUMMY; // Needed to force correct order of following
extern BPQVECSTRUC BPQHOSTVECTOR[BPQHOSTSTREAMS + 5];
extern int NODEORDER;
extern UCHAR LINKEDFLAG;
extern UCHAR UNPROTOCALL[80];
extern char * INFOMSG;
extern int INFOLEN;
extern char * CTEXTMSG;
extern int CTEXTLEN;
extern UCHAR MYALIAS[7]; // ALIAS IN AX25 FORM
extern UCHAR BBSALIAS[7];
extern UINT TRACE_Q; // TRANSMITTED FRAMES TO BE TRACED
extern char HEADERCHAR; // CHAR FOR _NODE HEADER MSGS
extern int AUTOSAVE; // AUTO SAVE NODES ON EXIT FLAG
extern int L4APPL; // Application for BBSCALL/ALIAS connects
extern int CFLAG; // C =HOST Command
extern VOID * IDMSG_Q; // ID/BEACONS WAITING TO BE SENT
extern struct DATAMESSAGE BTHDDR;
extern struct _MESSAGE IDHDDR;
extern VOID * IDMSG;
extern int L3TIMER; // TIMER FOR 'NODES' MESSAGE
extern int IDTIMER; // TIMER FOR ID MESSAGE
extern int BTTIMER; // TIMER FOR BT MESSAGE
extern int STATSTIME;
extern BOOL IPRequired;
extern int MaxHops;
extern int MAXRTT;
extern USHORT CWTABLE[];
extern TRANSPORTENTRY * L4TABLE;
extern UCHAR ROUTEQUAL;
extern UINT BPQMsg;
extern UCHAR ExcludeList[];
extern APPLCALLS APPLCALLTABLE[];
extern char VersionStringWithBuild[];
extern char VersionString[];
extern int MAXHEARDENTRIES;
extern int MHLEN;
extern APRSSTATIONRECORD * MHDATA;
extern int APPL1;
extern int PASSCMD;
extern int NUMBEROFCOMMANDS;
extern char * ConfigBuffer;
extern char * RigConfigMsg[];
extern char * WL2KReportLine[];
extern CMDX COMMANDS[];
extern int QCOUNT, MAXBUFFS, MAXCIRCUITS, L4DEFAULTWINDOW, L4T1, CMDXLEN;
extern char CMDALIAS[ALIASLEN][NumberofAppls];
extern int SEMGETS;
extern int SEMRELEASES;
extern int SEMCLASHES;
extern int MINBUFFCOUNT;
extern UCHAR BPQDirectory[];
extern UCHAR BPQProgramDirectory[];
extern char WINMOR[];
extern char PACTORCALL[];
extern UCHAR MCOM;
extern UCHAR MUIONLY;
extern UCHAR MTX;
extern ULONG MMASK;
extern UCHAR NODECALL[]; // NODES in ax.25
extern int L4CONNECTSOUT;
extern int L4CONNECTSIN;
extern int L4FRAMESTX;
extern int L4FRAMESRX;
extern int L4FRAMESRETRIED;
extern int OLDFRAMES;
extern int L3FRAMES;
extern char * PortConfig[];
extern struct SEM Semaphore;
extern UCHAR AuthorisedProgram; // Local Variable. Set if Program is on secure list
extern int REALTIMETICKS;
// SNMP Variables
int InOctets[32];
int OutOctets[32];