1 /*---------------------------------------------------------------------------* 2 Project: Horizon 3 File: socket_Common.h 4 5 Copyright (C)2009-2012 Nintendo Co., Ltd. All rights reserved. 6 7 These coded instructions, statements, and computer programs contain 8 proprietary information of Nintendo of America Inc. and/or Nintendo 9 Company Ltd., and are protected by Federal copyright law. They may 10 not be disclosed to third parties or copied or duplicated in any form, 11 in whole or in part, without the prior written consent of Nintendo. 12 13 $Rev: 46347 $ 14 *---------------------------------------------------------------------------*/ 15 16 #ifndef NN_SOCKET_SOCKET_COMMON_H_ 17 #define NN_SOCKET_SOCKET_COMMON_H_ 18 19 #include <nn/types.h> 20 #include <nn/os/os_Event.h> 21 #include <nn/fnd/fnd_Allocator.h> 22 #include <nn/socket/socket_Types.h> 23 24 namespace nn { 25 namespace socket { 26 27 const char PORT_NAME_USER[] = "soc:U"; 28 const char PORT_NAME_PRIVILEGED[] = "soc:P"; 29 30 namespace detail{ 31 void* Allocate(size_t size, s32 alignment = sizeof(int)); 32 Result Allocate(void*& p, size_t size, s32 alignment = sizeof(int)); 33 void Free(void* p); 34 } 35 36 /* Please see man pages for details 37 38 39 40 */ 41 42 /* Please see man pages for details 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 */ 82 Result Initialize(uptr bufferAddress, size_t bufferSize, s32 bufferSizeForSockets, s32 maxSessions); 83 84 85 /* Please see man pages for details 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 */ 102 size_t GetRequiredMemorySize(size_t bufferSizeForSockets, s32 maxSessions); 103 104 105 /* Please see man pages for details 106 107 108 109 */ 110 Result Initialize(nn::fnd::IAllocator& allocator, size_t bufferSize, s32 maxSessions) NN_ATTRIBUTE_DEPRECATED; 111 112 /* Please see man pages for details 113 114 115 116 117 118 119 */ 120 Result Initialize(void); 121 122 123 /* Please see man pages for details 124 125 126 127 128 129 */ 130 Result Finalize(void); 131 132 133 /* Please see man pages for details 134 135 136 137 138 139 140 141 142 143 144 */ 145 Result InitializePrivilegedControl(bool bUseSecondarySession = false); 146 147 148 /* Please see man pages for details 149 150 151 152 153 */ 154 Result FinalizePrivilegedControl(void); 155 156 /* Please see man pages for details 157 158 159 160 161 162 163 164 165 166 167 168 169 */ 170 Result Startup(const Config& config); 171 172 /* Please see man pages for details 173 174 175 176 177 178 179 180 181 182 */ 183 Result Cleanup(void); 184 185 /* Please see man pages for details 186 187 188 189 190 */ 191 Result AbortStartup(void); 192 193 /* Please see man pages for details 194 195 196 197 198 199 */ 200 201 Result CloseAll(void); 202 Result CloseAll(bit32 processId); 203 204 Result SetMaxDescriptor(s32 number); 205 Result AllowOtherProcess(s32 s); 206 207 208 /* Please see man pages for details 209 210 211 212 213 214 215 216 217 */ 218 Result GetConfigError(s32* err); 219 220 /* Please see man pages for details 221 222 223 224 225 226 227 228 229 230 231 232 233 */ 234 Result GetErrorReportEvent(nn::os::Event& event); 235 236 /* 237 238 */ 239 } 240 } 241 242 #endif // ifndef NN_SOCKET_SOCKET_COMMON_H_ 243