Leaked source code of windows server 2003
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.

161 lines
4.0 KiB

  1. /*++
  2. Copyright (c) 1995-1998 Microsoft Corporation
  3. Module Name:
  4. lookup.h
  5. Abstract:
  6. Contains interface for a generalized best
  7. matching prefix lookup data structure.
  8. Author:
  9. Chaitanya Kodeboyina (chaitk) 20-Jun-1998
  10. Revision History:
  11. --*/
  12. #ifndef __ROUTING_LOOKUP_H__
  13. #define __ROUTING_LOOKUP_H__
  14. #ifdef __cplusplus
  15. extern "C"
  16. {
  17. #endif
  18. //
  19. // Flags used to control the information dumped by the DumpTable func.
  20. //
  21. #define SUMMARY 0x00
  22. #define STATS 0x01
  23. #define ITEMS 0x02
  24. #define VERBOSE 0xFF
  25. //
  26. // Field used to link the data item in the lookup structure
  27. // [ Eg: A LIST_ENTRY field is used to link into a d-list ]
  28. //
  29. typedef struct _LOOKUP_LINKAGE
  30. {
  31. PVOID Pointer1; // Usage depends on implementation
  32. PVOID Pointer2; // Usage depends on implementation
  33. }
  34. LOOKUP_LINKAGE, *PLOOKUP_LINKAGE;
  35. //
  36. // Context returned in Search useful in following Inserts and Deletes.
  37. //
  38. // This context remains valid after a search only until the
  39. // read/write lock that is taken for the search is released.
  40. //
  41. typedef struct _LOOKUP_CONTEXT
  42. {
  43. PVOID Context1; // Usage depends on implementation
  44. PVOID Context2; // Usage depends on implementation
  45. PVOID Context3; // Usage depends on implementation
  46. PVOID Context4; // Usage depends on implementation
  47. }
  48. LOOKUP_CONTEXT, *PLOOKUP_CONTEXT;
  49. DWORD
  50. WINAPI
  51. CreateTable(
  52. IN UINT MaxBytes,
  53. OUT HANDLE *Table
  54. );
  55. DWORD
  56. WINAPI
  57. InsertIntoTable(
  58. IN HANDLE Table,
  59. IN USHORT NumBits,
  60. IN PUCHAR KeyBits,
  61. IN PLOOKUP_CONTEXT Context OPTIONAL,
  62. IN PLOOKUP_LINKAGE Data
  63. );
  64. DWORD
  65. WINAPI
  66. DeleteFromTable(
  67. IN HANDLE Table,
  68. IN USHORT NumBits,
  69. IN PUCHAR KeyBits,
  70. IN PLOOKUP_CONTEXT Context OPTIONAL,
  71. OUT PLOOKUP_LINKAGE *Data
  72. );
  73. DWORD
  74. WINAPI
  75. SearchInTable(
  76. IN HANDLE Table,
  77. IN USHORT NumBits,
  78. IN PUCHAR KeyBits,
  79. OUT PLOOKUP_CONTEXT Context OPTIONAL,
  80. OUT PLOOKUP_LINKAGE *Data
  81. );
  82. DWORD
  83. WINAPI
  84. BestMatchInTable(
  85. IN HANDLE Table,
  86. IN PUCHAR KeyBits,
  87. OUT PLOOKUP_LINKAGE *BestData
  88. );
  89. DWORD
  90. WINAPI
  91. NextMatchInTable(
  92. IN HANDLE Table,
  93. IN PLOOKUP_LINKAGE BestData,
  94. OUT PLOOKUP_LINKAGE *NextBestData
  95. );
  96. DWORD
  97. WINAPI
  98. EnumOverTable(
  99. IN HANDLE Table,
  100. IN OUT PUSHORT StartNumBits,
  101. IN OUT PUCHAR StartKeyBits,
  102. IN OUT PLOOKUP_CONTEXT Context OPTIONAL,
  103. IN USHORT StopNumBits OPTIONAL,
  104. IN PUCHAR StopKeyBits OPTIONAL,
  105. IN OUT PUINT NumItems,
  106. OUT PLOOKUP_LINKAGE *DataItems
  107. );
  108. DWORD
  109. WINAPI
  110. DestroyTable(
  111. IN HANDLE Table
  112. );
  113. DWORD
  114. WINAPI
  115. GetStatsFromTable(
  116. IN HANDLE Table,
  117. OUT PVOID Stats
  118. );
  119. BOOL
  120. WINAPI
  121. CheckTable(
  122. IN HANDLE Table
  123. );
  124. VOID
  125. WINAPI
  126. DumpTable(
  127. IN HANDLE Table,
  128. IN DWORD Flags
  129. );
  130. #ifdef __cplusplus
  131. }
  132. #endif
  133. #endif //__ROUTING_LOOKUP_H__