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.

103 lines
3.2 KiB

  1. Can we provide (in the NSP timeframe) a generic URI-based IPC mechanism for
  2. NT5 (and, in future releases, NT4 & Win9x)? More importantly, can this
  3. mechanism be leveraged by UL?
  4. The goal here is to totally separate the "listening" and "dispatching"
  5. functionality. We'll provide a general IPC mechanism that everyone can
  6. use. It just so happens that three of the customers will be a) the listener,
  7. b) the worker processes, and c) the WAS.
  8. Consider a completely stateless IPC mechanism based on only three APIs:
  9. ULONG
  10. RegisterUri(
  11. OUT PHANDLE UriHandle,
  12. IN HANDLE ParentUri OPTIONAL,
  13. IN PWSTR pUri,
  14. IN ULONG Flags
  15. );
  16. ULONG
  17. SendMessage(
  18. IN HANDLE UriHandle,
  19. IN PWSTR pSourceSuffix OPTIONAL,
  20. IN PWSTR pTargetUri,
  21. IN PVOID pData,
  22. IN ULONG DataLength,
  23. OUT PULONG pBytesSent OPTIONAL,
  24. IN LPOVERLAPPED pOverlapped OPTIONAL
  25. );
  26. typedef struct _MESSAGE
  27. {
  28. ULONG SourceUriLength;
  29. ULONG TargetUriLength;
  30. ULONG DataLength;
  31. ULONG Reserved;
  32. // WCHAR SourceUri[SourceUriLength];
  33. // WCHAR TargetUri[TargetUriLength];
  34. // UCHAR Alignment[varies];
  35. // UCHAR Data[DataLength];
  36. } MESSAGE, *PMESSAGE;
  37. ULONG
  38. ReceiveMessage(
  39. IN HANDLE UriHandle,
  40. OUT PMESSAGE pMessageBuffer,
  41. IN ULONG MessageBufferLength,
  42. OUT PULONG pBytesReceived OPTIONAL,
  43. IN LPOVERLAPPED pOverlapped OPTIONAL
  44. );
  45. A request/response API can be built on top of these three primitives:
  46. 1. Process 1: Creates new GUID -> GUID1
  47. 2. Process 1: Registers "ipc:/GUID1" -> REG1
  48. 3. Process 2: Registers "http://foo" -> REG2
  49. 4. Process 2: Posts ReceiveMessage( REG2 )
  50. 5. Process 1: Creates request ID (another GUID?) -> RID1
  51. 6. Process 1: SendMessage(
  52. REG1,
  53. "RID1",
  54. "http://foo/bar/xyz.htm",
  55. {request_blob}
  56. );
  57. 7. Process 1: Posts ReceiveMessage( REG1 )
  58. 8. Process 2: ReceiveMessage() completes with
  59. SourceUri = "ipc:/GUID1/RID1"
  60. TargetUri = "http://foo/bar/xyz.htm"
  61. Data = {request_blob}
  62. 9. Process 2: SendMessage(
  63. REG2,
  64. "bar/xyz.htm", <- URI "stem"
  65. "ipc:/GUID1/RID1", <- old source URI
  66. {response_blob}
  67. );
  68. 10. Process 1: ReceiveMessage() completes with
  69. SourceUri = "http://foo/bar/xyz.htm"
  70. TargetUri = "ipc:/GUID1/RID1"
  71. Data = {response_blob}
  72. 08/23/1999 I don't think this totally stateless idea is going to work.
  73. Well, it *could* work, but it places way to much burden on the
  74. client & server writers to properly manage concepts like
  75. keep-alive and dead peer detection. I'm now thinking we should
  76. go to more of a handle-based mechanism with a sockets-like
  77. flavor.