Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

893 lines
25 KiB

  1. #ifndef _NMSDB_
  2. #define _NMSDB_
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. /*++
  7. Copyright (c) 1989 Microsoft Corporation
  8. Module Name:
  9. nmsdb.h
  10. Abstract:
  11. This header file is for interfacing with the database manager component
  12. of the name space manager. The database manager component is a front-end to the database engine used for WINS server.
  13. The database engine used for the WINS server currently is JetBlue.
  14. Functions:
  15. Portability:
  16. This header file is portable.
  17. Author:
  18. Pradeep Bahl (PradeepB) Jan-1993
  19. Revision History:
  20. Modification Date Person Description of Modification
  21. ------------------ ------- ---------------------------
  22. --*/
  23. /*
  24. Includes
  25. */
  26. #include "wins.h"
  27. #include "comm.h"
  28. #include "nmsscv.h"
  29. #include "esent.h"
  30. #include "winsthd.h"
  31. #include "winsintf.h"
  32. /*
  33. defines
  34. */
  35. //
  36. // The size of of an array required to hold the IP Address in ascii form.
  37. //
  38. // Used by NmsNmhNamRegInd, NmsNmhQueryRow, and NmsNmhReplRegInd
  39. //
  40. #define NMSDB_MAX_NET_ADD_ARR_SZ 10
  41. #define NMSDB_LOCAL_OWNER_ID 0 //local WINS always uses 0 for owner id.
  42. //
  43. // NOTE NOTE NOTE
  44. //
  45. //
  46. #define NMSDB_MAX_OWNERS_INITIALLY 100 //max. number of owners in db
  47. #define NMSDB_MAX_MEMS_IN_GRP 25 //max. # of members in group
  48. /*
  49. Mask for retrieving different fields in the flag byte of a database entry
  50. */
  51. #define NMSDB_BIT_ENT_TYP 0x03 //bit 0 and 1
  52. #define NMSDB_BIT_STATE 0x0C //bits 2 and 3
  53. #define NMSDB_BIT_LOCAL 0x10 //bit 4
  54. #define NMSDB_BIT_NODE_TYP 0x60 //bit 5 and 6
  55. #define NMSDB_BIT_STATIC 0x80 // bit 7
  56. /*
  57. Values to be stored in the flag byte for certain entry types
  58. NOTE: Don't change the values unless you change the WINSINTF_TYPE_E too.
  59. The values are same for the enum types in the above enumerator (kept same
  60. for performance reasons -- check out winsintf.c)
  61. */
  62. #define NMSDB_UNIQUE_ENTRY 0
  63. #define NMSDB_NORM_GRP_ENTRY 1
  64. #define NMSDB_SPEC_GRP_ENTRY 2
  65. #define NMSDB_MULTIHOMED_ENTRY 3
  66. //
  67. // is not stored in the db. Used by winsprs functions only
  68. //
  69. #define NMSDB_USER_SPEC_GRP_ENTRY 4
  70. /*
  71. The shift to the left to be given to values of various items to be stored
  72. in the flag byte
  73. */
  74. #define NMSDB_SHIFT_ENT_TYP 0 //bit 0 and 1
  75. #define NMSDB_SHIFT_STATE 2 //bit 2 and 3
  76. #define NMSDB_SHIFT_LOCAL 4 //bit 4
  77. #define NMSDB_SHIFT_NODE_TYP 5 //bit 5
  78. #define NMSDB_SHIFT_STATIC 7 //bit 7
  79. #define NMSDB_ENTRY_IS_STATIC 1
  80. #define NMSDB_ENTRY_IS_NOT_STATIC 0
  81. /*
  82. NMSDB_MAX_NAM_LEN
  83. RFC 1002 states
  84. To simplify implementationss, the total length of label octets
  85. and label length octets that make up a domain name is restricted to
  86. 255 or less.
  87. Note: the number is a multiple of 8 (fortunately)
  88. */
  89. //
  90. // If we are running some internal tests, we will be writing names that
  91. // did not resolve on a query to a file. We add a \n to the name. Therefore
  92. // the max size is being increased by 1 (so that when we get a name that
  93. // is 255 bytes long, we do not go past the name array) -- see NmsNmhNamQuery
  94. //
  95. #ifdef TEST_DATA
  96. #define NMSDB_MAX_NAM_LEN 257
  97. #else
  98. #define NMSDB_MAX_NAM_LEN 256 //maximum length of name-- RFC 1002
  99. #endif
  100. /*
  101. Error status codes returned by NmsDb functions
  102. */
  103. FUTURES("Get rid of these. Use WINS status codes")
  104. #define NMSDB_SUCCESS 0x0
  105. #define NMSDB_CONFLICT (NMSDB_SUCCESS + 0x1) //conflict with an existing rec
  106. /*
  107. limit of addresses in group reached
  108. */
  109. #define NMSDB_ADD_LMT_IN_GRP_REACHED (NMSDB_SUCCESS + 0x2)
  110. #define NMSDB_NO_SUCH_ROW (NMSDB_SUCCESS + 0x3)
  111. #define NMSDB_NAM_ADD_TBL_NM "NamAddTbl"
  112. #define NMSDB_OWN_ADD_TBL_NM "OwnAddTbl"
  113. /*
  114. names for the indices used on the Name to Address mapping table
  115. */
  116. #define NMSDB_NAM_ADD_CLUST_INDEX_NAME "NETBIOSNAME"
  117. #define NMSDB_NAM_ADD_PRIM_INDEX_NAME "OWNERVERSION"
  118. //
  119. // Name of index used on the Owner to Address mapping table
  120. //
  121. #define NMSDB_OWN_ADD_CLUST_INDEX_NAME "OWNERID"
  122. /*
  123. * no of pages to allocate initially for the Name to address mapping table
  124. */
  125. //
  126. // 250 pages means 1 MB of space. This should be good enough
  127. // If more are needed, the table will be extended by an extent amount
  128. //
  129. #define NMSDB_NAM_ADD_TBL_PGS 250
  130. #define NMSDB_OWN_ADD_TBL_PGS 1
  131. /*
  132. The density values specified when creating Name to address mapping table
  133. and the indices on the same
  134. */
  135. #define NMSDB_NAM_ADD_TBL_DENSITY 80 //density when creating nam-ip tbl
  136. #define NMSDB_NAM_ADD_CLUST_INDEX_DENSITY 80 //density when creating cl. index
  137. #define NMSDB_NAM_ADD_PRIM_INDEX_DENSITY 80 //density when creating pr. index
  138. /*
  139. The density values specified when creating Owner to address mapping table
  140. and the indices on the same
  141. */
  142. #define NMSDB_OWN_ADD_TBL_DENSITY 80 //density when creating nam-ip tbl
  143. #define NMSDB_OWN_ADD_CLUST_INDEX_DENSITY 80 //density when creating cl. index
  144. /*
  145. macros
  146. */
  147. //
  148. // This macro gets the pointer to the Thread specific storage
  149. //
  150. FUTURES("Get rid of the return")
  151. #define GET_TLS_M(pTls) { \
  152. DWORD _Error; \
  153. pTls = TlsGetValue(WinsTlsIndex); \
  154. if (pTls == NULL) \
  155. { \
  156. _Error = GetLastError(); \
  157. return(WINS_FAILURE); \
  158. } \
  159. }
  160. //
  161. // macros to get/set the various attributes of an entry from the flags byte
  162. //
  163. #define NMSDB_ENTRY_STATE_M(Flag) (((Flag) & NMSDB_BIT_STATE) >> NMSDB_SHIFT_STATE)
  164. #define NMSDB_ENTRY_TYPE_M(Flag) (((Flag) & NMSDB_BIT_ENT_TYP) >> NMSDB_SHIFT_ENT_TYP)
  165. #define NMSDB_NODE_TYPE_M(Flag) (((Flag) & NMSDB_BIT_NODE_TYP) >> NMSDB_SHIFT_NODE_TYP)
  166. //
  167. // These macros evaluate to TRUE or FALSE
  168. //
  169. #define NMSDB_IS_ENTRY_LOCAL_M(Flag) ((Flag) & NMSDB_BIT_LOCAL ? TRUE : FALSE)
  170. #define NMSDB_SET_ENTRY_LOCAL_M(Flag) (Flag) |= NMSDB_BIT_LOCAL
  171. #define NMSDB_CLR_ENTRY_LOCAL_M(Flag) (Flag) &= ~NMSDB_BIT_LOCAL
  172. #define NMSDB_IS_ENTRY_STATIC_M(Flag) ((Flag) & NMSDB_BIT_STATIC ? TRUE : FALSE)
  173. #define NMSDB_CLR_ENTRY_TYPE_M(Flag) (Flag) &= ~NMSDB_BIT_ENT_TYP
  174. #define NMSDB_SET_ENTRY_TYPE_M(Flag, EntType) { \
  175. NMSDB_CLR_ENTRY_TYPE_M((Flag)); \
  176. (Flag) |= ((EntType) << NMSDB_SHIFT_ENT_TYP); \
  177. }
  178. #define NMSDB_CLR_STATE_M(Flag) (Flag) &= ~NMSDB_BIT_STATE
  179. #define NMSDB_SET_STATE_M(Flag, state) { \
  180. NMSDB_CLR_STATE_M((Flag)); \
  181. (Flag) |= ((state) << NMSDB_SHIFT_STATE); \
  182. }
  183. #define NMSDB_CLR_NODE_TYPE_M(Flag) (Flag) &= ~NMSDB_BIT_NODE_TYP
  184. #define NMSDB_SET_NODE_TYPE_M(Flag, NodeType) { \
  185. NMSDB_CLR_NODE_TYPE_M((Flag)); \
  186. (Flag) |= ((NodeType) << NMSDB_SHIFT_NODE_TYP); \
  187. }
  188. #define NMSDB_CLR_STDYN_M(Flag) (Flag) &= ~NMSDB_BIT_STATIC
  189. #define NMSDB_SET_STDYN_M(Flag, StDynTyp) { \
  190. NMSDB_CLR_STDYN_M(Flag); \
  191. (Flag) |= ((StDynTyp) << NMSDB_SHIFT_STATIC); \
  192. }
  193. #define NMSDB_SET_STATIC_M(Flag) (Flag) |= NMSDB_BIT_STATIC
  194. #define NMSDB_SET_DYNAMIC_M(Flag) (Flag) &= ~NMSDB_BIT_STATIC
  195. #define NMSDB_ENTRY_ACT_M(Flag) (NMSDB_ENTRY_STATE_M(Flag) == NMSDB_E_ACTIVE)
  196. #define NMSDB_ENTRY_REL_M(Flag) (NMSDB_ENTRY_STATE_M(Flag) == NMSDB_E_RELEASED)
  197. #define NMSDB_ENTRY_TOMB_M(Flag) (NMSDB_ENTRY_STATE_M(Flag) == NMSDB_E_TOMBSTONE)
  198. #define NMSDB_ENTRY_DEL_M(Flag) (NMSDB_ENTRY_STATE_M(Flag) == NMSDB_E_DELETED)
  199. //
  200. // Remember NameLen includes the EOS
  201. //
  202. FUTURES("Remove the following when support for spec. grp masks is put in")
  203. #define NMSDB_IS_IT_SPEC_GRP_NM_M(pName) (*((pName) + 15) == 0x1C)
  204. //
  205. // Used in NmsDbGetDataRecs()
  206. //
  207. #define NMSDB_IS_IT_PDC_NM_M(pName) (*(pName) == 0x1B)
  208. #define NMSDB_IS_IT_DOMAIN_NM_M(pName) (*((pName) + 15) == 0x1C)
  209. #define NMSDB_IS_IT_BROWSER_NM_M(pName) (*((pName) + 15) == 0x1D)
  210. #define NMSDB_ENTRY_UNIQUE_M(EntTyp) ((EntTyp) == NMSDB_UNIQUE_ENTRY)
  211. #define NMSDB_ENTRY_NORM_GRP_M(EntTyp) ((EntTyp) == NMSDB_NORM_GRP_ENTRY)
  212. #define NMSDB_ENTRY_SPEC_GRP_M(EntTyp) ((EntTyp) == NMSDB_SPEC_GRP_ENTRY)
  213. #define NMSDB_ENTRY_MULTIHOMED_M(EntTyp) ((EntTyp) == NMSDB_MULTIHOMED_ENTRY)
  214. #define NMSDB_ENTRY_GRP_M(EntTyp) ((EntTyp) == NMSDB_NORM_GRP_ENTRY || \
  215. (EntTyp) == NMSDB_SPEC_GRP_ENTRY)
  216. #define NMSDB_ENTRY_USER_SPEC_GRP_M(pName, EntTyp) ((NMSDB_ENTRY_SPEC_GRP_M((EntTyp))) && !(NMSDB_IS_IT_SPEC_GRP_NM_M((pName))))
  217. //
  218. // Backup stuff
  219. //
  220. #if NEW_JET || DYNLOADJET
  221. #define NMSDB_FULL_BACKUP (JET_bitBackupAtomic)
  222. #define NMSDB_INCREMENTAL_BACKUP ((JET_bitBackupIncremental) | (JET_bitBackupAtomic))
  223. typedef enum {
  224. DYN_LOAD_JET_200,
  225. DYN_LOAD_JET_500,
  226. DYN_LOAD_JET_600,
  227. } DYN_LOAD_JET_VERSION ;
  228. extern DYN_LOAD_JET_VERSION DynLoadJetVersion;
  229. //extern BOOL fDynLoadJet500;
  230. //extern BOOL fDynLoadJet600;
  231. #else
  232. #define NMSDB_FULL_BACKUP (JET_bitOverwriteExisting)
  233. #define NMSDB_INCREMENTAL_BACKUP (JET_bitBackupIncremental)
  234. #endif
  235. //
  236. // Store the name in allocated memory if the name length is > 16.
  237. //
  238. // If the name is less than 17 bytes (can only happen if a small name is
  239. // read in from a file -name within quotes is inserted in exactly the same
  240. // form - or when an admin. inserts a smaller name via winscl), we allocate
  241. // 17 bytes. This is to protect against an access violation that may happen
  242. // if the record that we have retrieved is a static - In GetGrpMem (called
  243. // from StoreGrpMem), we access the 16th byte of the name field to see if it
  244. // is 1C.
  245. // We are not bothered that the 16th byte will always be 0 (allocated memory
  246. // is initialized to 0) since we want the test in GetGrpMem to fail - see
  247. // GetGrpMem
  248. //
  249. #define NMSDB_STORE_NAME_M(pTls, pRec, pLclName, NameLen) \
  250. { \
  251. pRec->pName = WinsMscHeapAlloc(pTls->HeapHdl, NameLen < WINS_MAX_NS_NETBIOS_NAME_LEN ? WINS_MAX_NS_NETBIOS_NAME_LEN : NameLen);\
  252. WINSMSC_MOVE_MEMORY_M(pRec->pName, pLclName, NameLen); \
  253. }
  254. #if 0
  255. //
  256. // Free all memory that may have been allocated for this record
  257. //
  258. #define NMSDB_FREE_REC_MEM_M(pRec) \
  259. { \
  260. if (pRec->NameLen > WINS_MAX_NS_NETBIOS_NAME_LEN) \
  261. { \
  262. WinsMscHeapFree(RplRecHeapHdl, pRec->pName); \
  263. } \
  264. }
  265. #endif
  266. /*
  267. externs
  268. */
  269. struct _NMSDB_ADD_STATE_T; //forward declaration
  270. //
  271. // Used during replication (response to get max vers # request)
  272. //
  273. extern VERS_NO_T NmsDbStartVersNo;
  274. extern WINS_UID_T NmsDbUid;
  275. //
  276. // In memory table that stores the state of each WINS server we know about
  277. // (as a PULL/PUSH pnr). The index of the array is the owner id for that
  278. // WINS server (used to tag records in the name-address mapping table)
  279. //
  280. extern struct _NMSDB_ADD_STATE_T *pNmsDbOwnAddTbl;
  281. extern DWORD NmsDbTotNoOfSlots;
  282. //
  283. // No of owners found in the Nam-Add mapping table
  284. //
  285. extern DWORD NmsDbNoOfOwners;
  286. //
  287. // No of owners found in the Own-Add mapping table
  288. //
  289. extern DWORD NmsDbNoOfPushPnrs;
  290. //
  291. // Stores the name of the database file
  292. //
  293. extern BYTE NmsDbDatabaseFileName[WINS_MAX_FILENAME_SZ];
  294. //
  295. // critical section to protect the NmsDbOwnAddTbl (in-memory table)
  296. //
  297. extern CRITICAL_SECTION NmsDbOwnAddTblCrtSec;
  298. #ifdef WINSDBG
  299. extern DWORD NmsDbDelDelDataRecs;
  300. extern DWORD NmsDbDelQueryNUpdRecs;
  301. #endif
  302. /*
  303. enumerations
  304. */
  305. /*
  306. NMSDB_TBL_ACTION_E
  307. Enumerates the actions that can be taken on a table
  308. Used by the Replicator when it calls NmsDbWriteOwnAddTbl at
  309. replication time
  310. */
  311. typedef enum _NMSDB_TBL_ACTION_E {
  312. NMSDB_E_INSERT_REC = 0, //Insert the record
  313. NMSDB_E_MODIFY_REC, //modify the record
  314. NMSDB_E_DELETE_REC //delete the record
  315. } NMSDB_TBL_ACTION_E, *PNMSDB_TBL_ACTION_E;
  316. /*
  317. NMSDB_WINS_STATE_E
  318. states of a WINS server.
  319. */
  320. typedef enum _NMSDB_WINS_STATE_E {
  321. NMSDB_E_WINS_ACTIVE = 0, /*WINS is active */
  322. NMSDB_E_WINS_DOWN, /*WINS is temporarily down (it may/may not have entries in the name-add table*/
  323. NMSDB_E_WINS_DELETED, //WINS is permanently down
  324. NMSDB_E_WINS_INCONSISTENT //WINS is permanently down
  325. } NMSDB_WINS_STATE_E, *PNMSDB_WINS_STATE_E;
  326. /*
  327. NMSDB_TBL_NAM_E - Enumerator for the different table names
  328. */
  329. typedef enum _TBL_NAM_E {
  330. NMSDB_E_NAM_ADD_TBL_NM = 0,
  331. NMSDB_E_OWN_ADD_TBL_NM
  332. } NMSDB_TBL_NAM_E, *PNMSDB_TBL_NAM_E;
  333. /*
  334. NMSDB_ADD_STATE_T
  335. Structure used to store the state of a WINS server
  336. */
  337. typedef struct _NMSDB_ADD_STATE_T {
  338. COMM_ADD_T WinsAdd;
  339. NMSDB_WINS_STATE_E WinsState_e;
  340. DWORD MemberPrec;
  341. VERS_NO_T StartVersNo;
  342. WINS_UID_T Uid;
  343. } NMSDB_ADD_STATE_T, *PNMSDB_ADD_STATE_T;
  344. /*
  345. states of a database entry.
  346. There are three states
  347. ACTIVE,
  348. RELEASED,
  349. TOMBSTONE.
  350. These states are stored in two bits of the flags byte. The values
  351. of these states should therefore be in the range 0-3 in the
  352. enumeration below.
  353. Enumeration is used to facilitate debugging since enumerated values
  354. are shown symbolically on many debuggers
  355. 4th state of NMSDB_E_DELETED is not stored in the database. It is
  356. used to mark an in-memory copy of the record as deleted for later
  357. removal from the db (see DoScavenging() in nmsscv.c)
  358. */
  359. typedef enum _NMSDB_ENTRY_STATE_E {
  360. NMSDB_E_ACTIVE = 0,
  361. NMSDB_E_RELEASED = 1,
  362. NMSDB_E_TOMBSTONE = 2,
  363. NMSDB_E_DELETED = 3
  364. } NMSDB_ENTRY_STATE_E, *PNMSDB_ENTRY_STATE_E;
  365. /*
  366. typedef definitions
  367. */
  368. /*
  369. NMSDB_TABLE_ID_T -- This is visible to DBM's clients making them
  370. oblivious of the database engine's structure name
  371. */
  372. typedef JET_TABLEID NMSDB_TABLE_ID_T, *PNMSDB_TABLE_ID_T;
  373. /*
  374. NMSDB_GRP_MEM_ENTRY -- entry for a special group member in the database
  375. */
  376. typedef struct _NMSDB_GRP_MEM_ENTRY_T {
  377. DWORD OwnerId;
  378. DWORD_PTR TimeStamp;
  379. COMM_ADD_T Add;
  380. } NMSDB_GRP_MEM_ENTRY_T, *PNMSDB_GRP_MEM_ENTRY_T;
  381. /*
  382. Structure to store addres(es) of a conlficting record
  383. */
  384. typedef struct _NMSDB_NODE_ADDS_T {
  385. DWORD NoOfMems; /*no. of addresses*/
  386. NMSDB_GRP_MEM_ENTRY_T Mem[NMSDB_MAX_MEMS_IN_GRP]; /*addresses */
  387. } NMSDB_NODE_ADDS_T, *PNMSDB_NODE_ADDS_T;
  388. /*
  389. NMSDB_ROW_INFO_T -- Contains fields that go into a row of the Name -address
  390. mapping table
  391. */
  392. typedef struct _NMSDB_ROW_INFO_T {
  393. BYTE Name[NMSDB_MAX_NAM_LEN]; //name to reg or query
  394. //or release. For
  395. //browsers, it has
  396. //the net add appended
  397. //to it
  398. LPBYTE pName;
  399. DWORD NameLen;
  400. PCOMM_ADD_T pNodeAdd; // Address of Node
  401. DWORD_PTR TimeStamp; // Time since Jan 1, 1970
  402. NMSDB_NODE_ADDS_T NodeAdds; // addresses (spec. group)
  403. VERS_NO_T VersNo; // Version No.
  404. DWORD StatCode; // Status
  405. NMSDB_ENTRY_STATE_E EntryState_e; // State of entry
  406. DWORD OwnerId; // Owner of the record
  407. BYTE NodeTyp; // Type of Node (B, M or P)
  408. BYTE EntTyp; // Group or Unique flag
  409. BOOL fUpdVersNo; // Update version number
  410. BOOL fUpdTimeStamp; // Update Time Stamp ?
  411. // field has IP Address appended
  412. BOOL fStatic; // indicates whether the record
  413. // is static (statically intialized)
  414. BOOL fAdmin; //administrative action (used only)
  415. //for releases
  416. BOOL fLocal; //Is it a local name
  417. // DWORD CommitGrBit; //kind of log flush
  418. } NMSDB_ROW_INFO_T, *PNMSDB_ROW_INFO_T;
  419. /*
  420. NMSDB_STAT_INFO_T -- Contains the status of a NmsDb call. If an error
  421. occurred, it also contains information pertaining to the error status.
  422. Currently, the error status is NMDB_CONFLICI and information returned is
  423. unique/group status and IP address(es) of the conflicting record in
  424. the database.
  425. */
  426. typedef NMSDB_ROW_INFO_T NMSDB_STAT_INFO_T, *PNMSDB_STAT_INFO_T;
  427. //////////////////////////////////////////////////////////////////////
  428. #if DYNLOADJET
  429. typedef JET_ERR (FAR JET_API *JETPROC)();
  430. typedef struct _NMSDB_JETFTBL_T {
  431. BYTE Index; //index into array
  432. LPCSTR pFName; //function name for jet 500
  433. DWORD FIndex; //function index for jet 200
  434. JETPROC pFAdd;
  435. } NMSDB_JETFTBL_T;
  436. #define NMSDB_SIZEOFJETFTBL sizeof(NmsDbJetFTbl)/sizeof(NMSDB_JETFTBL_T)
  437. typedef enum {
  438. Init,
  439. Term,
  440. Term2,
  441. SetSystemParameter,
  442. BeginSession,
  443. EndSession,
  444. CreateDatabase,
  445. AttachDatabase,
  446. DetachDatabase,
  447. CreateTable,
  448. DeleteTable,
  449. GetTableColumnInfo,
  450. GetColumnInfo,
  451. AddColumn,
  452. CreateIndex,
  453. BeginTransaction,
  454. CommitTransaction,
  455. Rollback,
  456. CloseDatabase,
  457. CloseTable,
  458. OpenDatabase,
  459. OpenTable,
  460. Delete,
  461. Update,
  462. RetrieveColumn,
  463. SetColumn,
  464. PrepareUpdate,
  465. GetCurrentIndex,
  466. SetCurrentIndex,
  467. Move,
  468. MakeKey,
  469. Seek,
  470. Backup,
  471. Restore
  472. } NMDB_JETFTBL_E;
  473. #define JetInit (*(NmsDbJetFTbl[Init].pFAdd))
  474. #define JetTerm (*(NmsDbJetFTbl[Term].pFAdd))
  475. #define JetTerm2 (*(NmsDbJetFTbl[Term2].pFAdd))
  476. #define JetSetSystemParameter (*(NmsDbJetFTbl[SetSystemParameter].pFAdd))
  477. #define JetBeginSession (*(NmsDbJetFTbl[BeginSession].pFAdd))
  478. #define JetEndSession (*(NmsDbJetFTbl[EndSession].pFAdd))
  479. #define JetCreateDatabase (*(NmsDbJetFTbl[CreateDatabase].pFAdd))
  480. #define JetAttachDatabase (*(NmsDbJetFTbl[AttachDatabase].pFAdd))
  481. #define JetDetachDatabase (*(NmsDbJetFTbl[DetachDatabase].pFAdd))
  482. #define JetCreateTable (*(NmsDbJetFTbl[CreateTable].pFAdd))
  483. #define JetDeleteTable (*(NmsDbJetFTbl[DeleteTable].pFAdd))
  484. #define JetGetTableColumnInfo (*(NmsDbJetFTbl[GetTableColumnInfo].pFAdd))
  485. #define JetGetColumnInfo (*(NmsDbJetFTbl[GetColumnInfo].pFAdd))
  486. #define JetAddColumn (*(NmsDbJetFTbl[AddColumn].pFAdd))
  487. #define JetCreateIndex (*(NmsDbJetFTbl[CreateIndex].pFAdd))
  488. #define JetBeginTransaction (*(NmsDbJetFTbl[BeginTransaction].pFAdd))
  489. #define JetCommitTransaction (*(NmsDbJetFTbl[CommitTransaction].pFAdd))
  490. #define JetRollback (*(NmsDbJetFTbl[Rollback].pFAdd))
  491. #define JetCloseDatabase (*(NmsDbJetFTbl[CloseDatabase].pFAdd))
  492. #define JetCloseTable (*(NmsDbJetFTbl[CloseTable].pFAdd))
  493. #define JetOpenDatabase (*(NmsDbJetFTbl[OpenDatabase].pFAdd))
  494. #define JetOpenTable (*(NmsDbJetFTbl[OpenTable].pFAdd))
  495. #define JetDelete (*(NmsDbJetFTbl[Delete].pFAdd))
  496. #define JetUpdate (*(NmsDbJetFTbl[Update].pFAdd))
  497. #define JetRetrieveColumn (*(NmsDbJetFTbl[RetrieveColumn].pFAdd))
  498. #define JetSetColumn (*(NmsDbJetFTbl[SetColumn].pFAdd))
  499. #define JetPrepareUpdate (*(NmsDbJetFTbl[PrepareUpdate].pFAdd))
  500. #define JetGetCurrentIndex (*(NmsDbJetFTbl[GetCurrentIndex].pFAdd))
  501. #define JetSetCurrentIndex (*(NmsDbJetFTbl[SetCurrentIndex].pFAdd))
  502. #define JetMove (*(NmsDbJetFTbl[Move].pFAdd))
  503. #define JetMakeKey (*(NmsDbJetFTbl[MakeKey].pFAdd))
  504. #define JetSeek (*(NmsDbJetFTbl[Seek].pFAdd))
  505. #define JetRestore (*(NmsDbJetFTbl[Restore].pFAdd))
  506. #define JetBackup (*(NmsDbJetFTbl[Backup].pFAdd))
  507. #endif
  508. //////////////////////////////////////////////////////////////////////
  509. /*
  510. function definitions
  511. */
  512. extern
  513. STATUS
  514. NmsDbInit(
  515. VOID
  516. );
  517. extern
  518. STATUS
  519. NmsDbInsertRowInd(
  520. IN PNMSDB_ROW_INFO_T pRowInfo,
  521. OUT PNMSDB_STAT_INFO_T pStatusInfo
  522. );
  523. extern
  524. STATUS
  525. NmsDbInsertRowGrp(
  526. IN PNMSDB_ROW_INFO_T pRowInfo,
  527. OUT PNMSDB_STAT_INFO_T pStatusInfo
  528. );
  529. extern
  530. STATUS
  531. NmsDbRelRow(
  532. IN PNMSDB_ROW_INFO_T pNmsDbRowInfo,
  533. OUT PNMSDB_STAT_INFO_T pStatusInfo
  534. );
  535. extern
  536. STATUS
  537. NmsDbQueryRow(
  538. IN PNMSDB_ROW_INFO_T pNmsDbRowInfo,
  539. OUT PNMSDB_STAT_INFO_T pStatusInfo
  540. );
  541. extern
  542. STATUS
  543. NmsDbUpdateRow(
  544. IN PNMSDB_ROW_INFO_T pNmsDbRowInfo,
  545. OUT PNMSDB_STAT_INFO_T pStatusInfo
  546. );
  547. STATUS
  548. NmsDbSeekNUpdateRow(
  549. IN PNMSDB_ROW_INFO_T pRowInfo,
  550. OUT PNMSDB_STAT_INFO_T pStatusInfo
  551. );
  552. extern
  553. VOID
  554. NmsDbThdInit(
  555. IN WINS_CLIENT_E Client_e
  556. );
  557. STATUS
  558. NmsDbEndSession (
  559. VOID
  560. );
  561. extern
  562. VOID
  563. NmsDbRelRes(
  564. VOID
  565. );
  566. extern
  567. STATUS
  568. NmsDbGetDataRecs(
  569. IN WINS_CLIENT_E Client_e,
  570. IN OPTIONAL INT ThdPrLvl,
  571. IN VERS_NO_T MinVersNo,
  572. IN VERS_NO_T MaxVersNo,
  573. IN DWORD MaxNoOfRecsReqd,
  574. IN BOOL fUpToLimit,
  575. IN BOOL fOnlyReplicaTomb,
  576. IN PNMSSCV_CLUT_T pClutter,
  577. IN PCOMM_ADD_T pWinsAdd,
  578. IN BOOL fOnlyDynRecs,
  579. IN DWORD RplType,
  580. OUT LPVOID *ppRspBuf,
  581. OUT LPDWORD pRspBufLen,
  582. OUT LPDWORD pNoOfRecs
  583. );
  584. extern
  585. STATUS
  586. NmsDbWriteOwnAddTbl (
  587. IN NMSDB_TBL_ACTION_E TblAct_e,
  588. IN DWORD OwnerId,
  589. IN PCOMM_ADD_T pWinsAdd,
  590. IN NMSDB_WINS_STATE_E WinsState_e,
  591. IN PVERS_NO_T pStartVersNo,
  592. IN PWINS_UID_T pUid
  593. );
  594. extern
  595. STATUS
  596. NmsDbUpdateVersNo (
  597. IN BOOL fAfterClash,
  598. IN PNMSDB_ROW_INFO_T pRowInfo,
  599. IN PNMSDB_STAT_INFO_T pStatusInfo
  600. );
  601. extern
  602. STATUS
  603. NmsDbSetCurrentIndex(
  604. IN NMSDB_TBL_NAM_E TblNm_e,
  605. IN LPBYTE pIndexNam
  606. );
  607. extern
  608. STATUS
  609. NmsDbQueryNUpdIfMatch(
  610. IN LPVOID pRecord,
  611. IN int ThdPrLvl,
  612. IN BOOL fChgPrLvl,
  613. IN WINS_CLIENT_E Client_e
  614. );
  615. extern
  616. STATUS
  617. NmsDbUpdHighestVersNoRec(
  618. IN PWINSTHD_TLS_T pTls,
  619. IN VERS_NO_T MyMaxVersNo,
  620. IN BOOL fEnterCrtSec
  621. );
  622. extern
  623. STATUS
  624. NmsDbDelDataRecs(
  625. #if 0
  626. PCOMM_ADD_T pWinsAdd,
  627. #endif
  628. DWORD dwOwnerId,
  629. VERS_NO_T MinVersNo,
  630. VERS_NO_T MaxVersNo,
  631. BOOL fEnterCrtSec,
  632. BOOL fFragmentedDel
  633. );
  634. extern
  635. STATUS
  636. NmsDbTombstoneDataRecs(
  637. DWORD dwOwnerId,
  638. VERS_NO_T MinVersNo,
  639. VERS_NO_T MaxVersNo
  640. );
  641. extern
  642. STATUS
  643. NmsDbSetFlushTime(
  644. DWORD WaitTime
  645. );
  646. extern
  647. STATUS
  648. NmsDbOpenTables(
  649. WINS_CLIENT_E Client_e
  650. );
  651. extern
  652. STATUS
  653. NmsDbCloseTables(
  654. VOID
  655. );
  656. extern
  657. STATUS
  658. NmsDbGetNamesWPrefixChar(
  659. BYTE PrefixChar,
  660. PWINSINTF_BROWSER_INFO_T *ppInfo,
  661. LPDWORD pEntriesRead
  662. );
  663. extern
  664. STATUS
  665. NmsDbCleanupOwnAddTbl(
  666. LPDWORD pNoOfOwners
  667. );
  668. extern
  669. STATUS
  670. NmsDbBackup(
  671. LPBYTE pBackupPath,
  672. DWORD TypeOfBackup
  673. );
  674. extern
  675. STATUS
  676. NmsDbGetDataRecsByName(
  677. LPBYTE pName,
  678. DWORD NameLen,
  679. DWORD Location,
  680. DWORD NoOfRecsDesired,
  681. PCOMM_ADD_T pWinsAdd,
  682. DWORD TypeOfRecs,
  683. LPVOID *ppBuff,
  684. LPDWORD pBuffLen,
  685. LPDWORD pNoOfRecsRet
  686. );
  687. extern
  688. STATUS
  689. NmsDbEndTransaction(
  690. VOID
  691. );
  692. #ifdef __cplusplus
  693. }
  694. #endif
  695. #endif //_NMSDB_