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.

60 lines
1.6 KiB

  1. #ifndef _HIERARCHY_H_
  2. #define _HIERARCHY_H_
  3. /*
  4. This file defines object hierarchy for P3P implementation
  5. */
  6. class P3PObject {
  7. public:
  8. virtual ~P3PObject() { } // Virtual destructor required for inheritance
  9. virtual int QueryProperty(int property, void *description, unsigned char *result, int space)
  10. { return -1; } // Provide stub implementation
  11. /* caution when overriding this function-- handles must point to the
  12. base class P3PObject regardless of actual derived class.
  13. pointer values would be different in the presence of MI */
  14. virtual P3PHANDLE GetHandle() { return (P3PHANDLE) this; }
  15. virtual void Free() { delete this; }
  16. };
  17. class P3PRequest : public P3PObject {
  18. public:
  19. P3PRequest(P3PSignal *pSignal=NULL);
  20. ~P3PRequest();
  21. virtual int execute() = 0;
  22. virtual int queryStatus() { return status; }
  23. virtual void Free();
  24. /* Function invoked by CreateThread --
  25. used for running P3P requests in separate thread. */
  26. static unsigned long __stdcall ExecRequest(void *pv);
  27. virtual void enterIOBoundState();
  28. virtual void leaveIOBoundState();
  29. protected:
  30. /* Default implementation provided for following functions... */
  31. virtual int run();
  32. virtual void waitForCompletion();
  33. HANDLE hComplete; /* Event handle for signaling completion */
  34. int status; /* Current status */
  35. P3PSignal retSignal;/* Used for signaling on non-blocking requests */
  36. CRITICAL_SECTION csRequest;
  37. BOOL fRunning : 1;
  38. BOOL fCancelled : 1;
  39. BOOL fIOBound : 1;
  40. };
  41. #endif