1 /*---------------------------------------------------------------------------* 2 Project: Horizon 3 File: socket_Common.h 4 5 Copyright (C)2010 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: 33107 $ 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 */ 83 Result Initialize(uptr bufferAddress, size_t bufferSize, s32 bufferSizeForSockets, s32 maxSessions); 84 85 86 /* Please see man pages for details 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 */ 103 size_t GetRequiredMemorySize(size_t bufferSizeForSockets, s32 maxSessions); 104 105 106 /* Please see man pages for details 107 108 109 110 */ 111 Result Initialize(nn::fnd::IAllocator& allocator, size_t bufferSize, s32 maxSessions) NN_ATTRIBUTE_DEPRECATED; 112 113 /* Please see man pages for details 114 115 116 117 118 119 120 */ 121 Result Initialize(void); 122 123 124 /* Please see man pages for details 125 126 127 128 129 130 */ 131 Result Finalize(void); 132 133 134 /* Please see man pages for details 135 136 137 138 139 140 141 142 143 144 145 */ 146 Result InitializePrivilegedControl(bool bUseSecondarySession = false); 147 148 149 /* Please see man pages for details 150 151 152 153 154 */ 155 Result FinalizePrivilegedControl(void); 156 157 /* Please see man pages for details 158 159 160 161 162 163 164 165 166 167 168 169 170 */ 171 Result Startup(const Config& config); 172 173 /* Please see man pages for details 174 175 176 177 178 179 180 181 182 183 */ 184 Result Cleanup(void); 185 186 /* Please see man pages for details 187 188 189 190 191 */ 192 Result AbortStartup(void); 193 194 /* Please see man pages for details 195 196 197 198 199 200 */ 201 202 Result CloseAll(void); 203 Result CloseAll(bit32 processId); 204 205 Result SetMaxDescriptor(s32 number); 206 Result AllowOtherProcess(s32 s); 207 208 209 /* Please see man pages for details 210 211 212 213 214 215 216 217 218 */ 219 Result GetConfigError(s32* err); 220 221 /* Please see man pages for details 222 223 224 225 226 227 228 229 230 231 232 233 234 */ 235 Result GetErrorReportEvent(nn::os::Event& event); 236 237 /* 238 239 */ 240 } 241 } 242 243 #endif // ifndef NN_SOCKET_SOCKET_COMMON_H_ 244