socket_dispatcher.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // Copyright 2021 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef SANDBOX_WIN_SRC_SOCKET_DISPATCHER_H_
  5. #define SANDBOX_WIN_SRC_SOCKET_DISPATCHER_H_
  6. #include <stdint.h>
  7. #include <winsock2.h>
  8. #include "base/memory/raw_ptr.h"
  9. #include "sandbox/win/src/crosscall_client.h"
  10. #include "sandbox/win/src/crosscall_server.h"
  11. #include "sandbox/win/src/interception.h"
  12. #include "sandbox/win/src/ipc_tags.h"
  13. #include "sandbox/win/src/sandbox_policy_base.h"
  14. namespace sandbox {
  15. // This class handles socket related IPC calls.
  16. class SocketDispatcher : public Dispatcher {
  17. public:
  18. explicit SocketDispatcher(PolicyBase* policy_base);
  19. ~SocketDispatcher() override = default;
  20. SocketDispatcher(const SocketDispatcher&) = delete;
  21. SocketDispatcher& operator=(const SocketDispatcher&) = delete;
  22. // Dispatcher interface.
  23. bool SetupService(InterceptionManager* manager, IpcTag service) override;
  24. private:
  25. // Processes IPC requests coming from calls to WS2_32!WSA_Socket in the
  26. // target.
  27. bool WS2Socket(IPCInfo* ipc,
  28. uint32_t af,
  29. uint32_t type,
  30. uint32_t protocol,
  31. InOutCountedBuffer* buffer);
  32. raw_ptr<PolicyBase> policy_base_;
  33. };
  34. } // namespace sandbox
  35. #endif // SANDBOX_WIN_SRC_SOCKET_DISPATCHER_H_