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.

62 lines
1.9 KiB

  1. /*
  2. * File: utils.h
  3. * Description: This file contains function prototypes for the utility
  4. * functions for the NLB KD extensions.
  5. * History: Created by shouse, 1.4.01
  6. */
  7. /* Prints an error message when the symbols are bad. */
  8. VOID ErrorCheckSymbols (CHAR * symbol);
  9. /* Tokenizes a string via a configurable list of tokens. */
  10. char * mystrtok (char * string, char * control);
  11. /* Returns a ULONG residing at a given memory location. */
  12. ULONG GetUlongFromAddress (ULONG64 Location);
  13. /* Returns a UCHAR residing at a given memory location. */
  14. UCHAR GetUcharFromAddress (ULONG64 Location);
  15. /* Returns a memory address residing at a given memory location. */
  16. ULONG64 GetPointerFromAddress (ULONG64 Location);
  17. /* Reads data from a memory location into a buffer. */
  18. BOOL GetData (IN LPVOID ptr, IN ULONG64 dwAddress, IN ULONG size, IN PCSTR type);
  19. /* Copies a string from memory into a buffer. */
  20. BOOL GetString (IN ULONG64 dwAddress, IN LPWSTR buf, IN ULONG MaxChars);
  21. /* Copies an ethernet MAC address from memory into a buffer. */
  22. BOOL GetMAC (IN ULONG64 dwAddress, IN UCHAR * buf, IN ULONG NumChars);
  23. /* Returns a string corresponding to the given connection flags. */
  24. CHAR * ConnectionFlagsToString (UCHAR cFlags);
  25. /* This IS the NLB hashing function. */
  26. ULONG Map (ULONG v1, ULONG v2);
  27. #define HASH1_SIZE 257
  28. #define HASH2_SIZE 59
  29. #pragma pack(4)
  30. typedef struct {
  31. ULONG Items[MAX_ITEMS];
  32. ULONG BitVector[(HASH1_SIZE+sizeof(ULONG))/sizeof(ULONG)];
  33. UCHAR HashTable[HASH2_SIZE+MAX_ITEMS];
  34. struct {
  35. ULONG NumChecks;
  36. ULONG NumFastChecks;
  37. ULONG NumArrayLookups;
  38. } stats;
  39. } DipList;
  40. #pragma pack()
  41. #define BITS_PER_HASHWORD (8*sizeof((DipList*)0)->BitVector[0])
  42. #define SELECTED_BIT(_hash_value) (0x1L << ((_hash_value) % BITS_PER_HASHWORD))
  43. /* This function searches a collision hash table for a given dedicated IP address and returns TRUE if found. */
  44. BOOL DipListCheckItem (ULONG64 pList, ULONG Value);