1 /*
2  *  RNtrack - FTN message tracker/router
3  *
4  *  pktbase.hpp - Work with *.PKT base
5  *
6  *  Copyright (c) 2003-2005 Alex Soukhotine, 2:5030/1157
7  *
8  *  This program is free software; you can redistribute it and/or modify
9  *  it under the terms of the GNU General Public License as published by
10  *  the Free Software Foundation; either version 2 of the License, or
11  *  (at your option) any later version.
12  *
13  *  $Id: pktbase.hpp 131 2011-03-20 16:48:35Z dukelsky $
14  */
15 
16 #ifndef _PKTBASE_HPP_
17 #define _PKTBASE_HPP_
18 
19 #if defined (__MSVC__)
20     #include "dirent/dirent.h"
21 #endif
22 #include "a_list.hpp"
23 #include "utils.hpp"
24 #include "fidoaddr.hpp"
25 #include "msg.hpp"
26 #include "msgbase.hpp"
27 #include "mytypes.hpp"
28 
29 
30 class PKTBASE : public MSGBASE
31 {
32     FA FMask;
33     char * DirName;
34     char * PktName;
35     char * MsgMask;
36     unsigned int MsgNum;
37     unsigned int MaxMsgNum;
38     int fNoCheckPwd;
39     FILE * fh;
40     DIR * dp;
41     int fForWrite;
42     int fCreated;
43 
44     bool _Close(void);
45     bool _Open(void);
46     void AddToMask(unsigned int Num);
47     bool CopyHeader(FILE * tf);
48     bool CopyTail(FILE * tf);
49     bool CopyMessages(FILE * tf);
50     bool CopyOneMessage(FILE * tf);
51     bool ReadHeader(FILE * tf, char * Buff);
52 
53 public:
54     bool WriteOneMsg(unsigned int Num, cMSG & m);
55 
56     PKTBASE();
57     ~PKTBASE();
58     void Print(void);
59     bool Set(char * c, int BaseType);
60     void Clear(void);
61     bool Next(void);
62     bool Rewind(void);
63     bool DeleteMsg(void);
64     bool ReadMsg(cMSG & m);
65     bool WriteMsg(cMSG & m);
66     bool WriteNewMsg(cMSG & m);
67     char * ReadToMem(void);
68     bool WriteFromMem(char * Buff); // { return FALSE; };
69     char * MessageName(void);
70     char * BaseName(void);
71     bool Renumber(void);
72     bool CheckOut(void);
73 
CheckIn(void)74     bool CheckIn(void)
75     {
76         return TRUE;
77     }
Open(void)78     bool Open(void)
79     {
80         return TRUE;
81     }
Close(void)82     bool Close(void)
83     {
84         return _Close();
85     }
86 };
87 
88 #endif
89 
90