1 unit Gpcfidoconf;
2 {
3 FIDOCONFIG --- library for fidonet configs
4 
5 Copyright (C) 1998-1999
6 
7 Matthias Tichy
8 
9 Fido:     2:2433/1245 2:2433/1247 2:2432/605.14
10 Internet: mtt@tichy.de
11 
12 Grimmestr. 12         Buchholzer Weg 4
13 33098 Paderborn       40472 Duesseldorf
14 Germany               Germany
15 
16 This file is part of FIDOCONFIG.
17 
18 This library is free software; you can redistribute it and/or
19 modify it under the terms of the GNU Library General Public
20 License as published by the Free Software Foundation; either
21 version 2 of the License, or (at your option) any later version.
22 
23 This library is distributed in the hope that it will be useful,
24 but WITHOUT ANY WARRANTY; without even the implied warranty of
25 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
26 Library General Public License for more details.
27 
28 You should have received a copy of the GNU Library General Public
29 License along with this library; see file COPYING. If not, write to the Free
30 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
31 }
32 
33 interface
34 {$l fidoconfig}
35 { C default packing is dword }
36 
37   const
38      MSGTYPE_PASSTHROUGH = $04;
39 {$ifdef UNIX}
40 
41   const
42      PATH_DELIM = '/';
43 {$else}
44 
45   const
46      PATH_DELIM = '\\';
47 {$endif}
48 type
49 	dword=longint;
50 {    var
51        actualLine : asmname 'actualLine' Pchar;
52        actualLineNr : asmname 'actualLineNr' Pchar;
53        wasErrorr : asmname 'wasError' Pchar;
54 }
striptwhitenull55   function striptwhite(str:pchar):Pchar;
56 
57 
58   type
59      saddr = record
60           zone : dword;
61           net : dword;
62           node : dword;
63           point : dword;
64           domain : Pchar;
65        end;
66      Psaddr = ^saddr;
67 
68      spack = record
69           packer : Pchar;
70           call : Pchar;
71        end;
72      Pspack = ^spack;
73 
74      eflavour = (normal,hold,crash,direct,immediate);
75 
76      eforward = (fOff,fSecure,fOn);
77 
78      eemptypktpwd = (eOff,eSecure,eOn);
79 
80      slink = record
81           hisAka : saddr;
82           ourAka : Psaddr;
83           name : Pchar;
84           defaultPwd : Pchar;
85           pktPwd : Pchar;
86           ticPwd : Pchar;
87           areaFixPwd : Pchar;
88           fileFixPwd : Pchar;
89           bbsPwd : Pchar;
90           sessionPwd : Pchar;
91           handle : Pchar;
92           autoAreaCreate : longint;
93           autoFileCreate : longint;
94           AreaFix : longint;
95           FileFix : longint;
96           forwardRequests : longint;
97           fReqFromUpLink : longint;
98           allowEmptyPktPwd : longint;
99           forwardPkts : eforward;
100           pktFile : Pchar;
101           packFile : Pchar;
102           floFile : Pchar;
103           bsyFile : Pchar;
104           packerDef : Pspack;
105           echoMailFlavour : eflavour;
106           LinkGrp : Pchar;
107           AccessGrp : Pchar;
108           autoAreaCreateFile : Pchar;
109           autoFileCreateFile : Pchar;
110           autoAreaCreateDefaults : Pchar;
111           autoFileCreateDefaults : Pchar;
112           forwardRequestFile : Pchar;
113           RemoteRobotName : Pchar;
114           msg : pointer;
115           Pause : longint;
116           autoPause : dword;
117           level : dword;
118           arcmailSize : dword;
119           export_a : Pchar;
120           import : Pchar;
121           mandatory : Pchar;
122           optGrp : Pchar;
123        end;
124      Pslink = ^slink;
125 
126 {     erouting = (host := 1,hub,boss,noroute);}
127 	erouting=dword;
128 
129 
130 
131   { if target = NULL use }
132   { this }
133      sroute = record
134           flavour : eflavour;
135           enc : char;
136           target : Pslink;
137           routeVia : erouting;
138           pattern : Pchar;
139        end;
140      Psroute = ^sroute;
141 
142      edupeCheck = (dcOff,dcMove,dcDel);
143 
144      sarealink = record
145           link : Pslink;
146           export_a : char;
147           import : char;
148           mandatory : char;
149        end;
150      Psarealink = ^sarealink;
151 
152      sarea = record
153           areaName : Pchar;
154           fileName : Pchar;
155           description : Pchar;
156           msgbType : longint;
157           useAka : Psaddr;
158           downlinks : ^Psarealink;
159           downlinkCount : dword;
160           purge : dword;
161           max : dword;
162           dupeSize : dword;
163           dupeHistory : dword;
164           keepunread,killread:char;
165           dupeCheck : edupeCheck;
166           tinySB : char;
167           manual : char;
168           hide : char;
169           noPause : char;
170           mandatory : char;
171           DOSFile : char;
172           levelread : dword;
173           levelwrite : dword;
174           dupes : pointer;
175           newDupes : pointer;
176           imported : dword;
177           group : char;
178           rwgrp : Pchar;
179           wgrp : Pchar;
180           rgrp : Pchar;
181           ccoff : cardinal;
182           uid,gid,perm:dword;
183           keepsb : longint;
184           scn : longint;
185        end;
186      Psarea = ^sarea;
187 
188      sfileareatype = record
189           areaName : Pchar;
190           pathName : Pchar;
191           description : Pchar;
192           pass : longint;
193           useAka : Psaddr;
194           downlinks : ^Psarealink;
195           downlinkCount : dword;
196           levelread : dword;
197           levelwrite : dword;
198           manual : char;
199           hide : char;
200           noPause : char;
201           group : char;
202           rwgrp : Pchar;
203           wgrp : Pchar;
204           rgrp : Pchar;
205        end;
206      Psfileareatype = ^sfileareatype;
207 
208      sbbsareatype = record
209           areaName : Pchar;
210           pathName : Pchar;
211           description : Pchar;
212        end;
213      Psbbsareatype = ^sbbsareatype;
214 
215 {     ecarbonType = (cto,cfrom,ckludge,csubject,cmsgtext);}
216 
217      scarbon = record
218 {          type : ecarbonType;}
219           type_a : dword;
220           str : Pchar;
221           area : Psarea;
222           export_a : longint;
223        end;
224      Pscarbon = ^scarbon;
225 
226      sunpack = record
227           offset : longint;
228           matchCode : ^byte;
229           mask : ^byte;
230           codeSize : longint;
231           call : Pchar;
232        end;
233      Psunpack = ^sunpack;
234 
235      sremap = record
236           oldaddr : saddr;
237           newaddr : saddr;
238           toname : Pchar;
239        end;
240      Psremap = ^sremap;
241 
242      sfidoconfig = record
243           cfgVersionMajor : dword;
244           cfgVersionMinor : dword;
245           name : Pchar;
246           location : Pchar;
247           sysop : Pchar;
248           addrCount : dword;
249           addr : Psaddr;
250           publicCount : dword;
251           publicDir : ^Pchar;
252           linkCount : dword;
253           links : Pslink;
254           inbound : Pchar;
255           outbound : Pchar;
256           protInbound : Pchar;
257           listInbound : Pchar;
258           localInbound : Pchar;
259           tempInbound : Pchar;
260           logFileDir : Pchar;
261           dupeHistoryDir : Pchar;
262           nodelistDir : Pchar;
263           msgBaseDir : Pchar;
264           magic : Pchar;
265           areafixhelp : Pchar;
266           filefixhelp : Pchar;
267           tempOutbound : Pchar;
268           ticoutbound : Pchar;
269           fileAreaBaseDir : Pchar;
270           passFileAreaDir : Pchar;
271           semaDir : Pchar;
272           badFilesDir : Pchar;
273           loglevels : Pchar;
274           dupeArea : sarea;
275           badArea : sarea;
276           netmailareacount:cardinal;
277           netmailareas:psarea;
278           echoAreaCount : dword;
279           echoAreas : Psarea;
280           localAreaCount : dword;
281           localAreas : Psarea;
282           fileAreaCount : dword;
283           fileAreas : Psfileareatype;
284           bbsAreaCount : dword;
285           bbsAreas : Psbbsareatype;
286           routeCount : dword;
287           route : Psroute;
288           routeFileCount : dword;
289           routeFile : Psroute;
290           routeMailCount : dword;
291           routeMail : Psroute;
292           packCount : dword;
293           pack : Pspack;
294           unpackCount : dword;
295           unpack : Psunpack;
296           intab : Pchar;
297           outtab : Pchar;
298           echotosslog : Pchar;
299           importlog : Pchar;
300           LinkWithImportlog : Pchar;
301           lockfile : Pchar;
302           fileAreasLog : Pchar;
303           longNameList : Pchar;
304           fileNewAreasLog : Pchar;
305           fileArcList : Pchar;
306           filePassList : Pchar;
307           fileDupeList : Pchar;
308           msgidfile : Pchar;
309           carbonCount : dword;
310           carbons : Pscarbon;
311           carbonAndQuit : dword;
312           carbonKeepSb : dword;
313           includeFiles : ^Pchar;
314           includeCount : dword;
315           remapCount : dword;
316           remaps : Psremap;
317           areafixFromPkt : dword;
318           areafixKillReports : dword;
319           areafixKillRequests : dword;
320           areafixMsgSize : dword;
321           areafixSplitStr : Pchar;
322           PublicGroup : Pchar;
323           ReportTo : Pchar;
324           logEchoToScreen : dword;
325           separateBundles : dword;
326           defarcmailSize : dword;
327           afterUnpack : Pchar;
328           beforePack : Pchar;
329           createDirs : dword;
330           longDirNames : dword;
331           splitDirs : dword;
332           addDLC : dword;
333           fileSingleDescLine : dword;
334           fileCheckDest : dword;
335           filefixKillReports : dword;
336           filefixKillRequests : dword;
337           fileDescPos : dword;
338           DLCDigits : dword;
339           fileMaxDupeAge : dword;
340           fileFileUMask : dword;
341           fileDirUMask : dword;
342           fileLocalPwd : Pchar;
343           fileLDescString : Pchar;
344        end;
345      Psfidoconfig = ^sfidoconfig;
346 
readConfignull347   function readConfig:Psfidoconfig;asmname 'readConfig';
348 
349   procedure disposeConfig(config:psfidoconfig);
350 
getLinknull351   function getLink(config:sfidoconfig; addr:pchar):Pslink;
352 
getLinkFromAddrnull353   function getLinkFromAddr(config:sfidoconfig; aka:saddr):Pslink;
354 
getAddrnull355   function getAddr(config:sfidoconfig; addr:pchar):Psaddr;
356 
existAddrnull357   function existAddr(config:sfidoconfig; aka:saddr):longint;
358 
getareanull359   function getarea(config:psfidoconfig; areaName:pchar):psarea;asmname 'getArea';
360 
361   {
362      This function return 0 if the link is not linked to the area,
363      else it returns 1.
364     }
isLinkOfAreanull365   function isLinkOfArea(link:pslink; area:psarea):longint;
366 
367   {
368      This function dumps the config to a file. The file is in fidoconfig format so,
369      it is possible to change the config in memory and write it to disk.
370      All formatting and comments are removed and the include structure of the config
371      cannot be recreated. So be careful. A file called <fileName> which already exists
372      will be overwritten.
373      1 if there were problems writing the config
374      0 else
375     }
dumpConfigToFilenull376   function dumpConfigToFile(config:psfidoconfig; fileName:pchar):longint;
377 
378 (*
379   { the following functions are for internal use. }
380   { Only use them if you really know what you do. }
381   function readLine(F:pFILE):Pchar;
382 
383   function parseLine(line:pchar; config:psfidoconfig):longint;
384 
385   procedure parseConfig(f:pFILE; config:psfidoconfig);
386 
387   function getConfigFileName:Pchar;
388 
389 *)
390 
trimLinenull391   function trimLine(line:pchar):Pchar;
392   {
393      This method can be used to get a program-specifically config-filename, in the same directories which are searched for fidoconfig.
394      envVar should be set to a string which resembles a environment-variable which should be checked if it includes the fileName.
395      configName is the filename of the config  without  any prefixes.
396      e.g.
397           getConfigFileNameForProgram("FIDOCONFIG", "config");
398      is the call which is used for fidoconfig
399     }
getConfigFileNameForProgramnull400   function getConfigFileNameForProgram(envVar:pchar; configName:pchar):Pchar;
401 
isLinkOfFileAreanull402   function isLinkOfFileArea(link:pslink; area:psfileareatype):longint;
403 
getFileAreanull404   function getFileArea(config:psfidoconfig; areaName:pchar):Psfileareatype;
405 
406 (*
407   { this function can be used to dump config to stdout or to an already opened file. }
408   procedure dumpConfig(config:psfidoconfig; f:pFILE);
409 *)
410 
411 
412 implementation
413 
414 {  function striptwhite(str:pchar):Pchar; external;
415   function readConfig:Psfidoconfig; external;
416   procedure disposeConfig(config:psfidoconfig); external;
417   function getLink(config:sfidoconfig; addr:pchar):Pslink; external;
418   function getLinkFromAddr(config:sfidoconfig; aka:saddr):Pslink; external;
419   function getAddr(config:sfidoconfig; addr:pchar):Psaddr; external;
420   function existAddr(config:sfidoconfig; aka:saddr):longint; external;
421   function getarea2(config:psfidoconfig; areaName:pchar):Psarea; asmname 'getarea';
422   function isLinkOfArea(link:pslink; area:psarea):longint; external;
423   function dumpConfigToFile(config:psfidoconfig; fileName:pchar):longint; external;
424 
425   function readLine(F:pFILE):Pchar; external;
426   function parseLine(line:pchar; config:psfidoconfig):longint; external;
427   procedure parseConfig(f:pFILE; config:psfidoconfig); external;
428 
429   function getConfigFileName:Pchar; external;
430   function trimLine(line:pchar):Pchar; external;
431   function getConfigFileNameForProgram(envVar:pchar; configName:pchar):Pchar; external;
432   function isLinkOfFileArea(link:pslink; area:psfileareatype):longint; external;
433   function getFileArea(config:psfidoconfig; areaName:pchar):Psfileareatype; external;
434 
435   procedure dumpConfig(config:psfidoconfig; f:pFILE); external;
436 }
437 
438 end.
439