ServiceBsd.cs 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. using Ryujinx.Core.OsHle.Ipc;
  2. using System.Collections.Generic;
  3. namespace Ryujinx.Core.OsHle.IpcServices.Bsd
  4. {
  5. class ServiceBsd : IIpcService
  6. {
  7. private Dictionary<int, ServiceProcessRequest> m_Commands;
  8. public IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
  9. public ServiceBsd()
  10. {
  11. m_Commands = new Dictionary<int, ServiceProcessRequest>()
  12. {
  13. { 0, Initialize },
  14. { 1, StartMonitoring },
  15. { 2, Socket },
  16. { 10, Send },
  17. { 14, Connect }
  18. };
  19. }
  20. //Initialize(u32, u32, u32, u32, u32, u32, u32, u32, u64 pid, u64 transferMemorySize, pid, KObject) -> u32 bsd_errno
  21. public long Initialize(ServiceCtx Context)
  22. {
  23. /*
  24. typedef struct {
  25. u32 version; // Observed 1 on 2.0 LibAppletWeb, 2 on 3.0.
  26. u32 tcp_tx_buf_size; // Size of the TCP transfer (send) buffer (initial or fixed).
  27. u32 tcp_rx_buf_size; // Size of the TCP recieve buffer (initial or fixed).
  28. u32 tcp_tx_buf_max_size; // Maximum size of the TCP transfer (send) buffer. If it is 0, the size of the buffer is fixed to its initial value.
  29. u32 tcp_rx_buf_max_size; // Maximum size of the TCP receive buffer. If it is 0, the size of the buffer is fixed to its initial value.
  30. u32 udp_tx_buf_size; // Size of the UDP transfer (send) buffer (typically 0x2400 bytes).
  31. u32 udp_rx_buf_size; // Size of the UDP receive buffer (typically 0xA500 bytes).
  32. u32 sb_efficiency; // Number of buffers for each socket (standard values range from 1 to 8).
  33. } BsdBufferConfig;
  34. */
  35. long Pid = Context.RequestData.ReadInt64();
  36. long TransferMemorySize = Context.RequestData.ReadInt64();
  37. // Two other args are unknown!
  38. Context.ResponseData.Write(0);
  39. //Todo: Stub
  40. return 0;
  41. }
  42. //StartMonitoring(u64, pid)
  43. public long StartMonitoring(ServiceCtx Context)
  44. {
  45. //Todo: Stub
  46. return 0;
  47. }
  48. //Socket(u32 domain, u32 type, u32 protocol) -> (i32 ret, u32 bsd_errno)
  49. public long Socket(ServiceCtx Context)
  50. {
  51. Context.ResponseData.Write(0);
  52. Context.ResponseData.Write(0);
  53. //Todo: Stub
  54. return 0;
  55. }
  56. //Connect(u32 socket, buffer<sockaddr, 0x21, 0>) -> (i32 ret, u32 bsd_errno)
  57. public long Connect(ServiceCtx Context)
  58. {
  59. Context.ResponseData.Write(0);
  60. Context.ResponseData.Write(0);
  61. //Todo: Stub
  62. return 0;
  63. }
  64. //Send(u32 socket, u32 flags, buffer<i8, 0x21, 0>) -> (i32 ret, u32 bsd_errno)
  65. public long Send(ServiceCtx Context)
  66. {
  67. Context.ResponseData.Write(0);
  68. Context.ResponseData.Write(0);
  69. //Todo: Stub
  70. return 0;
  71. }
  72. }
  73. }