1 /*****************************************************************************/ 2 /* */ 3 /* (C) Copyright 1992-1997 Alberto Pasquale */ 4 /* Portions (C) Copyright 1999 Per Lundberg */ 5 /* */ 6 /* A L L R I G H T S R E S E R V E D */ 7 /* */ 8 /*****************************************************************************/ 9 /* */ 10 /* How to contact the author: Alberto Pasquale of 2:332/504@fidonet */ 11 /* Viale Verdi 106 */ 12 /* 41100 Modena */ 13 /* Italy */ 14 /* */ 15 /*****************************************************************************/ 16 17 #ifndef V7_HPP 18 #define V7_HPP 19 20 extern "C" { 21 typedef struct { 22 word Zone; 23 word Net; 24 word Node; 25 word HubNode; 26 word CallCost; /* phone company's charge */ 27 word MsgFee; /* Amount charged to user for a message */ 28 word NodeFlags; /* set of flags (see below) */ 29 byte ModemType; /* RESERVED for modem type */ 30 byte Phone_len; 31 byte Password_len; 32 byte Bname_len; 33 byte Sname_len; 34 byte Cname_len; 35 byte pack_len; 36 byte BaudRate; /* baud rate divided by 300 */ 37 } _vers7 __attribute__ ((packed)); 38 39 /* defines for NodeFlags word */ 40 41 #define B_hub 0x0001 /* node is a net hub 0000 0000 0000 0001 */ 42 #define B_host 0x0002 /* node is a net host 0000 0000 0000 0010 */ 43 #define B_region 0x0004 /* node is region coord 0000 0000 0000 0100 */ 44 #define B_zone 0x0008 /* node is a zone coord 0000 0000 0000 1000 */ 45 #define B_CM 0x0010 /* runs continuous mail 0000 0000 0001 0000 */ 46 #define B_ores1 0x0020 /* reserved for Opus 0000 0000 0010 0000 */ 47 #define B_ores2 0x0040 /* reserved for Opus 0000 0000 0100 0000 */ 48 #define B_ores3 0x0080 /* reserved for Opus 0000 0000 1000 0000 */ 49 #define B_ores4 0x0100 /* reserved for Opus 0000 0001 0000 0000 */ 50 #define B_ores5 0x0200 /* reserved for Opus 0000 0010 0000 0000 */ 51 #define B_res1 0x0400 /* reserved for non-Opus 0000 0100 0000 0000 */ 52 #define B_res2 0x0800 /* reserved for non-Opus 0000 1000 0000 0000 */ 53 #define B_point 0x1000 /* node is a point 0001 0000 0000 0000 */ 54 #define B_res3 0x2000 /* reserved for non-Opus 0010 0000 0000 0000 */ 55 #define B_res4 0x4000 /* reserved for non-Opus 0100 0000 0000 0000 */ 56 #define B_res5 0x8000 /* reserved for non-Opus 1000 0000 0000 0000 */ 57 58 59 #define B_admin (B_hub|B_host|B_region|B_zone|B_point) 60 61 62 #define ndx7recsz 512 // for mkndx7 functions 63 64 typedef struct { /* structure for temporary NODEXNDX.$$$ */ 65 ADR adr; 66 dword datofs; 67 } _ndx7s; 68 69 /*--------------------------------------------------------------------------*/ 70 /* nodex.ndx */ 71 /* */ 72 /* Version 7 Nodelist Index structure. This is a 512-byte record, which */ 73 /* is defined by three structures: Record 0 is the Control Record, then */ 74 /* some number of Leaf Node (LNode) Records, then the Index Node (INode) */ 75 /* Records. This defines an unbalanced binary tree. */ 76 /* */ 77 /*--------------------------------------------------------------------------*/ 78 79 typedef struct { 80 word CtlBlkSize; /* Blocksize of Index Blocks */ 81 long CtlRoot; /* Block number of Root */ 82 long CtlHiBlk; /* Block number of last block */ 83 long CtlLoLeaf; /* Block number of first leaf */ 84 long CtlHiLeaf; /* Block number of last leaf */ 85 long CtlFree; /* Head of freelist */ 86 word CtlLvls; /* Number of index levels */ 87 word CtlParity; /* XOR of above fields */ 88 } __attribute__ ((packed)) _CtlBlk; 89 90 typedef struct { /* IndxFirst is -1 in LNodes */ 91 long IndxFirst; /* Pointer to next lower level */ 92 long IndxBLink; /* Pointer to previous link */ 93 long IndxFLink; /* Pointer to next link */ 94 short IndxCnt; /* Count of Items in block */ 95 word IndxStr; /* Offset in block of 1st str */ 96 struct _LeafRef { 97 word KeyOfs; /* Offset of string into block */ 98 word KeyLen; /* Length of string */ 99 long KeyVal; /* Pointer to data block */ 100 } LeafRef[62]; 101 } __attribute__ ((packed)) _LNodeBlk; 102 103 typedef struct { 104 long IndxFirst; /* Pointer to next lower level */ 105 long IndxBLink; /* Pointer to previous link */ 106 long IndxFLink; /* Pointer to next link */ 107 short IndxCnt; /* Count of Items in block */ 108 word IndxStr; /* Offset in block of 1st str */ 109 /* If IndxFirst is NOT -1, this is INode: */ 110 struct _IndxRef { 111 word IndxOfs; /* Offset of string into block */ 112 word IndxLen; /* Length of string */ 113 long IndxData;/* Record number of string */ 114 long IndxPtr; /* Block number of lower index */ 115 } IndxRef[41]; 116 } __attribute__ ((packed)) _INodeBlk; 117 118 119 #define OfsNoLink 0xffffffff 120 121 // this is common for all systems 122 struct _DTPAllLnk { 123 word Region; 124 word Hub; 125 dword SOfs; // DAT offset of next Same SysOp entry 126 dword POfs; // DAT offset of next Same Phone entry 127 dword FeOfs; // DAT offset of next "Equal Fido Level" 128 byte Sn; // Number (base 0) of SysOp entry (ADR order) 129 byte Pn; // Number (base 0) of Phone entry (ADR order) 130 } __attribute__ ((packed)); 131 132 // nodes only (no points) 133 struct _DTPNodeLnk { 134 word ndowns; // number of systems in lower level 135 dword FlOfs; // DAT offset of "Lower Fido Level" 136 } __attribute__ ((packed)); 137 138 139 struct _DTPLnk { 140 _DTPAllLnk A; 141 _DTPNodeLnk N; 142 } __attribute__ ((packed)); 143 144 // first record of DTP file 145 struct _DTPCtl { 146 word size; // Size of this control record 147 byte Version; // Version of DTP file 148 byte AllFixSize; // sizeof (_DTPAllLnk) 149 byte AddFixSize; // sizeof (_DTPNodeLnk) 150 } __attribute__ ((packed)); 151 152 153 struct _DTPHead { 154 _DTPCtl ctl; 155 _DTPNodeLnk lnk; 156 } __attribute__ ((packed)); 157 }; 158 159 #endif 160