bsd_u.cpp 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. // Copyright 2018 yuzu emulator team
  2. // Licensed under GPLv2 or any later version
  3. // Refer to the license.txt file included.
  4. #include "core/hle/ipc_helpers.h"
  5. #include "core/hle/service/sockets/bsd_u.h"
  6. namespace Service {
  7. namespace Sockets {
  8. void BSD_U::RegisterClient(Kernel::HLERequestContext& ctx) {
  9. LOG_WARNING(Service, "(STUBBED) called");
  10. IPC::ResponseBuilder rb{ctx, 3};
  11. rb.Push(RESULT_SUCCESS);
  12. rb.Push<u32>(0); // bsd errno
  13. }
  14. void BSD_U::StartMonitoring(Kernel::HLERequestContext& ctx) {
  15. LOG_WARNING(Service, "(STUBBED) called");
  16. IPC::ResponseBuilder rb{ctx, 3};
  17. rb.Push(RESULT_SUCCESS);
  18. rb.Push<u32>(0); // bsd errno
  19. }
  20. void BSD_U::Socket(Kernel::HLERequestContext& ctx) {
  21. IPC::RequestParser rp{ctx};
  22. u32 domain = rp.Pop<u32>();
  23. u32 type = rp.Pop<u32>();
  24. u32 protocol = rp.Pop<u32>();
  25. LOG_WARNING(Service, "(STUBBED) called domain=%u type=%u protocol=%u", domain, type, protocol);
  26. u32 fd = next_fd++;
  27. IPC::ResponseBuilder rb{ctx, 4};
  28. rb.Push(RESULT_SUCCESS);
  29. rb.Push<u32>(fd);
  30. rb.Push<u32>(0); // bsd errno
  31. }
  32. void BSD_U::Connect(Kernel::HLERequestContext& ctx) {
  33. LOG_WARNING(Service, "(STUBBED) called");
  34. IPC::ResponseBuilder rb{ctx, 4};
  35. rb.Push(RESULT_SUCCESS);
  36. rb.Push<u32>(0); // ret
  37. rb.Push<u32>(0); // bsd errno
  38. }
  39. void BSD_U::SendTo(Kernel::HLERequestContext& ctx) {
  40. LOG_WARNING(Service, "(STUBBED) called");
  41. IPC::ResponseBuilder rb{ctx, 4};
  42. rb.Push(RESULT_SUCCESS);
  43. rb.Push<u32>(0); // ret
  44. rb.Push<u32>(0); // bsd errno
  45. }
  46. void BSD_U::Close(Kernel::HLERequestContext& ctx) {
  47. LOG_WARNING(Service, "(STUBBED) called");
  48. IPC::ResponseBuilder rb{ctx, 4};
  49. rb.Push(RESULT_SUCCESS);
  50. rb.Push<u32>(0); // ret
  51. rb.Push<u32>(0); // bsd errno
  52. }
  53. BSD_U::BSD_U() : ServiceFramework("bsd:u") {
  54. static const FunctionInfo functions[] = {{0, &BSD_U::RegisterClient, "RegisterClient"},
  55. {1, &BSD_U::StartMonitoring, "StartMonitoring"},
  56. {2, &BSD_U::Socket, "Socket"},
  57. {11, &BSD_U::SendTo, "SendTo"},
  58. {14, &BSD_U::Connect, "Connect"},
  59. {26, &BSD_U::Close, "Close"}};
  60. RegisterHandlers(functions);
  61. }
  62. } // namespace Sockets
  63. } // namespace Service