]> Chaos Git - corbenik/ctrulib.git/commitdiff
SOC:u added close/shutdown sockets
authorLectem <lectem@gmail.com>
Sun, 17 Jan 2016 02:13:22 +0000 (21:13 -0500)
committerLectem <lectem@gmail.com>
Sun, 17 Jan 2016 02:14:09 +0000 (21:14 -0500)
libctru/include/3ds/services/soc.h
libctru/source/services/soc/soc_closesockets.c [new file with mode: 0644]
libctru/source/services/soc/soc_shutdownsockets.c [new file with mode: 0644]

index b5ac85ec8aec7ffb75128dca14d90ed248013782..60f7b274b8fa9e4d0e15f3296ba73a5e5c918c0b 100644 (file)
@@ -27,3 +27,6 @@ Result socExit(void);
  */
 long gethostid(void);
 
+int SOCU_ShutdownSockets();
+
+int SOCU_CloseSockets();
diff --git a/libctru/source/services/soc/soc_closesockets.c b/libctru/source/services/soc/soc_closesockets.c
new file mode 100644 (file)
index 0000000..6b5a8aa
--- /dev/null
@@ -0,0 +1,15 @@
+#include "soc_common.h"
+#include <3ds/ipc.h>
+#include <3ds/result.h>
+
+int SOCU_CloseSockets()
+{
+       u32 *cmdbuf = getThreadCommandBuffer();
+
+       cmdbuf[0] = IPC_MakeHeader(0x21,0,2); // 0x210002;
+       cmdbuf[1] = IPC_Desc_CurProcessHandle();
+
+       int ret = svcSendSyncRequest(SOCU_handle);
+       if(R_FAILED(ret))return ret;
+       return cmdbuf[1];
+}
diff --git a/libctru/source/services/soc/soc_shutdownsockets.c b/libctru/source/services/soc/soc_shutdownsockets.c
new file mode 100644 (file)
index 0000000..1649846
--- /dev/null
@@ -0,0 +1,14 @@
+#include "soc_common.h"
+#include <3ds/ipc.h>
+#include <3ds/result.h>
+
+int SOCU_ShutdownSockets()
+{
+       u32 *cmdbuf = getThreadCommandBuffer();
+
+       cmdbuf[0] = IPC_MakeHeader(0x19,0,0); // 0x190000
+
+       int ret = svcSendSyncRequest(SOCU_handle);
+       if(R_FAILED(ret))return ret;
+       return cmdbuf[1];
+}