Commit 124963045ddf2989c6df437dd88627be982cf55a
1 parent
b6c7dfc7
no message
Showing
33 changed files
with
0 additions
and
4664 deletions
Too many changes to show.
To preserve performance only 33 of 217 files are displayed.
CNLiveXMPPManagerDemo/CNLiveXMPPManagerDemo.xcodeproj/project.pbxproj deleted
100644 → 0
| 1 | -// !$*UTF8*$! | ||
| 2 | -{ | ||
| 3 | - archiveVersion = 1; | ||
| 4 | - classes = { | ||
| 5 | - }; | ||
| 6 | - objectVersion = 46; | ||
| 7 | - objects = { | ||
| 8 | - | ||
| 9 | -/* Begin PBXBuildFile section */ | ||
| 10 | - 326B73AA1E03A66000F21637 /* CNLiveXMPPSDK.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 326B73A81E03A65C00F21637 /* CNLiveXMPPSDK.framework */; }; | ||
| 11 | - 326B73AB1E03A66000F21637 /* CNLiveXMPPSDK.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 326B73A81E03A65C00F21637 /* CNLiveXMPPSDK.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; | ||
| 12 | - 327977C31D9BBF1D00679858 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 327977C21D9BBF1D00679858 /* main.m */; }; | ||
| 13 | - 327977C61D9BBF1D00679858 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 327977C51D9BBF1D00679858 /* AppDelegate.m */; }; | ||
| 14 | - 327977C91D9BBF1D00679858 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 327977C81D9BBF1D00679858 /* ViewController.m */; }; | ||
| 15 | - 327977CC1D9BBF1D00679858 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 327977CA1D9BBF1D00679858 /* Main.storyboard */; }; | ||
| 16 | - 327977CE1D9BBF1D00679858 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 327977CD1D9BBF1D00679858 /* Assets.xcassets */; }; | ||
| 17 | - 327977D11D9BBF1D00679858 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 327977CF1D9BBF1D00679858 /* LaunchScreen.storyboard */; }; | ||
| 18 | - 327977E41D9BBF7200679858 /* CocoaAsyncSocket.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 327977D91D9BBF6100679858 /* CocoaAsyncSocket.framework */; }; | ||
| 19 | - 327977E51D9BBF7200679858 /* CocoaAsyncSocket.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 327977D91D9BBF6100679858 /* CocoaAsyncSocket.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; | ||
| 20 | - 327977E61D9BBF7200679858 /* CocoaLumberjack.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 327977DA1D9BBF6100679858 /* CocoaLumberjack.framework */; }; | ||
| 21 | - 327977E71D9BBF7200679858 /* CocoaLumberjack.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 327977DA1D9BBF6100679858 /* CocoaLumberjack.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; | ||
| 22 | - 327977E81D9BBF7200679858 /* KissXML.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 327977DB1D9BBF6100679858 /* KissXML.framework */; }; | ||
| 23 | - 327977E91D9BBF7200679858 /* KissXML.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 327977DB1D9BBF6100679858 /* KissXML.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; | ||
| 24 | - 327977EA1D9BBF7200679858 /* XMPPFramework.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 327977DC1D9BBF6100679858 /* XMPPFramework.framework */; }; | ||
| 25 | - 327977EB1D9BBF7200679858 /* XMPPFramework.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 327977DC1D9BBF6100679858 /* XMPPFramework.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; | ||
| 26 | -/* End PBXBuildFile section */ | ||
| 27 | - | ||
| 28 | -/* Begin PBXCopyFilesBuildPhase section */ | ||
| 29 | - 327977EC1D9BBF7200679858 /* Embed Frameworks */ = { | ||
| 30 | - isa = PBXCopyFilesBuildPhase; | ||
| 31 | - buildActionMask = 2147483647; | ||
| 32 | - dstPath = ""; | ||
| 33 | - dstSubfolderSpec = 10; | ||
| 34 | - files = ( | ||
| 35 | - 327977E91D9BBF7200679858 /* KissXML.framework in Embed Frameworks */, | ||
| 36 | - 326B73AB1E03A66000F21637 /* CNLiveXMPPSDK.framework in Embed Frameworks */, | ||
| 37 | - 327977E51D9BBF7200679858 /* CocoaAsyncSocket.framework in Embed Frameworks */, | ||
| 38 | - 327977E71D9BBF7200679858 /* CocoaLumberjack.framework in Embed Frameworks */, | ||
| 39 | - 327977EB1D9BBF7200679858 /* XMPPFramework.framework in Embed Frameworks */, | ||
| 40 | - ); | ||
| 41 | - name = "Embed Frameworks"; | ||
| 42 | - runOnlyForDeploymentPostprocessing = 0; | ||
| 43 | - }; | ||
| 44 | -/* End PBXCopyFilesBuildPhase section */ | ||
| 45 | - | ||
| 46 | -/* Begin PBXFileReference section */ | ||
| 47 | - 326B73A81E03A65C00F21637 /* CNLiveXMPPSDK.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = CNLiveXMPPSDK.framework; sourceTree = "<group>"; }; | ||
| 48 | - 327977BE1D9BBF1D00679858 /* CNLiveXMPPManagerDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CNLiveXMPPManagerDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; | ||
| 49 | - 327977C21D9BBF1D00679858 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; }; | ||
| 50 | - 327977C41D9BBF1D00679858 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; }; | ||
| 51 | - 327977C51D9BBF1D00679858 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; }; | ||
| 52 | - 327977C71D9BBF1D00679858 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = "<group>"; }; | ||
| 53 | - 327977C81D9BBF1D00679858 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = "<group>"; }; | ||
| 54 | - 327977CB1D9BBF1D00679858 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; }; | ||
| 55 | - 327977CD1D9BBF1D00679858 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; }; | ||
| 56 | - 327977D01D9BBF1D00679858 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; }; | ||
| 57 | - 327977D21D9BBF1D00679858 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; | ||
| 58 | - 327977D91D9BBF6100679858 /* CocoaAsyncSocket.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = CocoaAsyncSocket.framework; sourceTree = "<group>"; }; | ||
| 59 | - 327977DA1D9BBF6100679858 /* CocoaLumberjack.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = CocoaLumberjack.framework; sourceTree = "<group>"; }; | ||
| 60 | - 327977DB1D9BBF6100679858 /* KissXML.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = KissXML.framework; sourceTree = "<group>"; }; | ||
| 61 | - 327977DC1D9BBF6100679858 /* XMPPFramework.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = XMPPFramework.framework; sourceTree = "<group>"; }; | ||
| 62 | -/* End PBXFileReference section */ | ||
| 63 | - | ||
| 64 | -/* Begin PBXFrameworksBuildPhase section */ | ||
| 65 | - 327977BB1D9BBF1D00679858 /* Frameworks */ = { | ||
| 66 | - isa = PBXFrameworksBuildPhase; | ||
| 67 | - buildActionMask = 2147483647; | ||
| 68 | - files = ( | ||
| 69 | - 327977E81D9BBF7200679858 /* KissXML.framework in Frameworks */, | ||
| 70 | - 327977E41D9BBF7200679858 /* CocoaAsyncSocket.framework in Frameworks */, | ||
| 71 | - 326B73AA1E03A66000F21637 /* CNLiveXMPPSDK.framework in Frameworks */, | ||
| 72 | - 327977E61D9BBF7200679858 /* CocoaLumberjack.framework in Frameworks */, | ||
| 73 | - 327977EA1D9BBF7200679858 /* XMPPFramework.framework in Frameworks */, | ||
| 74 | - ); | ||
| 75 | - runOnlyForDeploymentPostprocessing = 0; | ||
| 76 | - }; | ||
| 77 | -/* End PBXFrameworksBuildPhase section */ | ||
| 78 | - | ||
| 79 | -/* Begin PBXGroup section */ | ||
| 80 | - 327977B51D9BBF1D00679858 = { | ||
| 81 | - isa = PBXGroup; | ||
| 82 | - children = ( | ||
| 83 | - 326B73A81E03A65C00F21637 /* CNLiveXMPPSDK.framework */, | ||
| 84 | - 327977D91D9BBF6100679858 /* CocoaAsyncSocket.framework */, | ||
| 85 | - 327977DA1D9BBF6100679858 /* CocoaLumberjack.framework */, | ||
| 86 | - 327977DB1D9BBF6100679858 /* KissXML.framework */, | ||
| 87 | - 327977DC1D9BBF6100679858 /* XMPPFramework.framework */, | ||
| 88 | - 327977C01D9BBF1D00679858 /* CNLiveXMPPManagerDemo */, | ||
| 89 | - 327977BF1D9BBF1D00679858 /* Products */, | ||
| 90 | - ); | ||
| 91 | - sourceTree = "<group>"; | ||
| 92 | - }; | ||
| 93 | - 327977BF1D9BBF1D00679858 /* Products */ = { | ||
| 94 | - isa = PBXGroup; | ||
| 95 | - children = ( | ||
| 96 | - 327977BE1D9BBF1D00679858 /* CNLiveXMPPManagerDemo.app */, | ||
| 97 | - ); | ||
| 98 | - name = Products; | ||
| 99 | - sourceTree = "<group>"; | ||
| 100 | - }; | ||
| 101 | - 327977C01D9BBF1D00679858 /* CNLiveXMPPManagerDemo */ = { | ||
| 102 | - isa = PBXGroup; | ||
| 103 | - children = ( | ||
| 104 | - 327977C41D9BBF1D00679858 /* AppDelegate.h */, | ||
| 105 | - 327977C51D9BBF1D00679858 /* AppDelegate.m */, | ||
| 106 | - 327977C71D9BBF1D00679858 /* ViewController.h */, | ||
| 107 | - 327977C81D9BBF1D00679858 /* ViewController.m */, | ||
| 108 | - 327977CA1D9BBF1D00679858 /* Main.storyboard */, | ||
| 109 | - 327977CD1D9BBF1D00679858 /* Assets.xcassets */, | ||
| 110 | - 327977CF1D9BBF1D00679858 /* LaunchScreen.storyboard */, | ||
| 111 | - 327977D21D9BBF1D00679858 /* Info.plist */, | ||
| 112 | - 327977C11D9BBF1D00679858 /* Supporting Files */, | ||
| 113 | - ); | ||
| 114 | - path = CNLiveXMPPManagerDemo; | ||
| 115 | - sourceTree = "<group>"; | ||
| 116 | - }; | ||
| 117 | - 327977C11D9BBF1D00679858 /* Supporting Files */ = { | ||
| 118 | - isa = PBXGroup; | ||
| 119 | - children = ( | ||
| 120 | - 327977C21D9BBF1D00679858 /* main.m */, | ||
| 121 | - ); | ||
| 122 | - name = "Supporting Files"; | ||
| 123 | - sourceTree = "<group>"; | ||
| 124 | - }; | ||
| 125 | -/* End PBXGroup section */ | ||
| 126 | - | ||
| 127 | -/* Begin PBXNativeTarget section */ | ||
| 128 | - 327977BD1D9BBF1D00679858 /* CNLiveXMPPManagerDemo */ = { | ||
| 129 | - isa = PBXNativeTarget; | ||
| 130 | - buildConfigurationList = 327977D51D9BBF1D00679858 /* Build configuration list for PBXNativeTarget "CNLiveXMPPManagerDemo" */; | ||
| 131 | - buildPhases = ( | ||
| 132 | - 327977BA1D9BBF1D00679858 /* Sources */, | ||
| 133 | - 327977BB1D9BBF1D00679858 /* Frameworks */, | ||
| 134 | - 327977BC1D9BBF1D00679858 /* Resources */, | ||
| 135 | - 327977EC1D9BBF7200679858 /* Embed Frameworks */, | ||
| 136 | - ); | ||
| 137 | - buildRules = ( | ||
| 138 | - ); | ||
| 139 | - dependencies = ( | ||
| 140 | - ); | ||
| 141 | - name = CNLiveXMPPManagerDemo; | ||
| 142 | - productName = CNLiveXMPPManagerDemo; | ||
| 143 | - productReference = 327977BE1D9BBF1D00679858 /* CNLiveXMPPManagerDemo.app */; | ||
| 144 | - productType = "com.apple.product-type.application"; | ||
| 145 | - }; | ||
| 146 | -/* End PBXNativeTarget section */ | ||
| 147 | - | ||
| 148 | -/* Begin PBXProject section */ | ||
| 149 | - 327977B61D9BBF1D00679858 /* Project object */ = { | ||
| 150 | - isa = PBXProject; | ||
| 151 | - attributes = { | ||
| 152 | - LastUpgradeCheck = 0800; | ||
| 153 | - ORGANIZATIONNAME = "雷浩杰"; | ||
| 154 | - TargetAttributes = { | ||
| 155 | - 327977BD1D9BBF1D00679858 = { | ||
| 156 | - CreatedOnToolsVersion = 8.0; | ||
| 157 | - DevelopmentTeam = 94X49GG3ZW; | ||
| 158 | - ProvisioningStyle = Automatic; | ||
| 159 | - }; | ||
| 160 | - }; | ||
| 161 | - }; | ||
| 162 | - buildConfigurationList = 327977B91D9BBF1D00679858 /* Build configuration list for PBXProject "CNLiveXMPPManagerDemo" */; | ||
| 163 | - compatibilityVersion = "Xcode 3.2"; | ||
| 164 | - developmentRegion = English; | ||
| 165 | - hasScannedForEncodings = 0; | ||
| 166 | - knownRegions = ( | ||
| 167 | - en, | ||
| 168 | - Base, | ||
| 169 | - ); | ||
| 170 | - mainGroup = 327977B51D9BBF1D00679858; | ||
| 171 | - productRefGroup = 327977BF1D9BBF1D00679858 /* Products */; | ||
| 172 | - projectDirPath = ""; | ||
| 173 | - projectRoot = ""; | ||
| 174 | - targets = ( | ||
| 175 | - 327977BD1D9BBF1D00679858 /* CNLiveXMPPManagerDemo */, | ||
| 176 | - ); | ||
| 177 | - }; | ||
| 178 | -/* End PBXProject section */ | ||
| 179 | - | ||
| 180 | -/* Begin PBXResourcesBuildPhase section */ | ||
| 181 | - 327977BC1D9BBF1D00679858 /* Resources */ = { | ||
| 182 | - isa = PBXResourcesBuildPhase; | ||
| 183 | - buildActionMask = 2147483647; | ||
| 184 | - files = ( | ||
| 185 | - 327977D11D9BBF1D00679858 /* LaunchScreen.storyboard in Resources */, | ||
| 186 | - 327977CE1D9BBF1D00679858 /* Assets.xcassets in Resources */, | ||
| 187 | - 327977CC1D9BBF1D00679858 /* Main.storyboard in Resources */, | ||
| 188 | - ); | ||
| 189 | - runOnlyForDeploymentPostprocessing = 0; | ||
| 190 | - }; | ||
| 191 | -/* End PBXResourcesBuildPhase section */ | ||
| 192 | - | ||
| 193 | -/* Begin PBXSourcesBuildPhase section */ | ||
| 194 | - 327977BA1D9BBF1D00679858 /* Sources */ = { | ||
| 195 | - isa = PBXSourcesBuildPhase; | ||
| 196 | - buildActionMask = 2147483647; | ||
| 197 | - files = ( | ||
| 198 | - 327977C91D9BBF1D00679858 /* ViewController.m in Sources */, | ||
| 199 | - 327977C61D9BBF1D00679858 /* AppDelegate.m in Sources */, | ||
| 200 | - 327977C31D9BBF1D00679858 /* main.m in Sources */, | ||
| 201 | - ); | ||
| 202 | - runOnlyForDeploymentPostprocessing = 0; | ||
| 203 | - }; | ||
| 204 | -/* End PBXSourcesBuildPhase section */ | ||
| 205 | - | ||
| 206 | -/* Begin PBXVariantGroup section */ | ||
| 207 | - 327977CA1D9BBF1D00679858 /* Main.storyboard */ = { | ||
| 208 | - isa = PBXVariantGroup; | ||
| 209 | - children = ( | ||
| 210 | - 327977CB1D9BBF1D00679858 /* Base */, | ||
| 211 | - ); | ||
| 212 | - name = Main.storyboard; | ||
| 213 | - sourceTree = "<group>"; | ||
| 214 | - }; | ||
| 215 | - 327977CF1D9BBF1D00679858 /* LaunchScreen.storyboard */ = { | ||
| 216 | - isa = PBXVariantGroup; | ||
| 217 | - children = ( | ||
| 218 | - 327977D01D9BBF1D00679858 /* Base */, | ||
| 219 | - ); | ||
| 220 | - name = LaunchScreen.storyboard; | ||
| 221 | - sourceTree = "<group>"; | ||
| 222 | - }; | ||
| 223 | -/* End PBXVariantGroup section */ | ||
| 224 | - | ||
| 225 | -/* Begin XCBuildConfiguration section */ | ||
| 226 | - 327977D31D9BBF1D00679858 /* Debug */ = { | ||
| 227 | - isa = XCBuildConfiguration; | ||
| 228 | - buildSettings = { | ||
| 229 | - ALWAYS_SEARCH_USER_PATHS = NO; | ||
| 230 | - CLANG_ANALYZER_NONNULL = YES; | ||
| 231 | - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; | ||
| 232 | - CLANG_CXX_LIBRARY = "libc++"; | ||
| 233 | - CLANG_ENABLE_MODULES = YES; | ||
| 234 | - CLANG_ENABLE_OBJC_ARC = YES; | ||
| 235 | - CLANG_WARN_BOOL_CONVERSION = YES; | ||
| 236 | - CLANG_WARN_CONSTANT_CONVERSION = YES; | ||
| 237 | - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; | ||
| 238 | - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; | ||
| 239 | - CLANG_WARN_EMPTY_BODY = YES; | ||
| 240 | - CLANG_WARN_ENUM_CONVERSION = YES; | ||
| 241 | - CLANG_WARN_INFINITE_RECURSION = YES; | ||
| 242 | - CLANG_WARN_INT_CONVERSION = YES; | ||
| 243 | - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; | ||
| 244 | - CLANG_WARN_SUSPICIOUS_MOVES = YES; | ||
| 245 | - CLANG_WARN_UNREACHABLE_CODE = YES; | ||
| 246 | - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; | ||
| 247 | - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; | ||
| 248 | - COPY_PHASE_STRIP = NO; | ||
| 249 | - DEBUG_INFORMATION_FORMAT = dwarf; | ||
| 250 | - ENABLE_STRICT_OBJC_MSGSEND = YES; | ||
| 251 | - ENABLE_TESTABILITY = YES; | ||
| 252 | - GCC_C_LANGUAGE_STANDARD = gnu99; | ||
| 253 | - GCC_DYNAMIC_NO_PIC = NO; | ||
| 254 | - GCC_NO_COMMON_BLOCKS = YES; | ||
| 255 | - GCC_OPTIMIZATION_LEVEL = 0; | ||
| 256 | - GCC_PREPROCESSOR_DEFINITIONS = ( | ||
| 257 | - "DEBUG=1", | ||
| 258 | - "$(inherited)", | ||
| 259 | - ); | ||
| 260 | - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; | ||
| 261 | - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; | ||
| 262 | - GCC_WARN_UNDECLARED_SELECTOR = YES; | ||
| 263 | - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; | ||
| 264 | - GCC_WARN_UNUSED_FUNCTION = YES; | ||
| 265 | - GCC_WARN_UNUSED_VARIABLE = YES; | ||
| 266 | - IPHONEOS_DEPLOYMENT_TARGET = 10.0; | ||
| 267 | - MTL_ENABLE_DEBUG_INFO = YES; | ||
| 268 | - ONLY_ACTIVE_ARCH = YES; | ||
| 269 | - SDKROOT = iphoneos; | ||
| 270 | - }; | ||
| 271 | - name = Debug; | ||
| 272 | - }; | ||
| 273 | - 327977D41D9BBF1D00679858 /* Release */ = { | ||
| 274 | - isa = XCBuildConfiguration; | ||
| 275 | - buildSettings = { | ||
| 276 | - ALWAYS_SEARCH_USER_PATHS = NO; | ||
| 277 | - CLANG_ANALYZER_NONNULL = YES; | ||
| 278 | - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; | ||
| 279 | - CLANG_CXX_LIBRARY = "libc++"; | ||
| 280 | - CLANG_ENABLE_MODULES = YES; | ||
| 281 | - CLANG_ENABLE_OBJC_ARC = YES; | ||
| 282 | - CLANG_WARN_BOOL_CONVERSION = YES; | ||
| 283 | - CLANG_WARN_CONSTANT_CONVERSION = YES; | ||
| 284 | - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; | ||
| 285 | - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; | ||
| 286 | - CLANG_WARN_EMPTY_BODY = YES; | ||
| 287 | - CLANG_WARN_ENUM_CONVERSION = YES; | ||
| 288 | - CLANG_WARN_INFINITE_RECURSION = YES; | ||
| 289 | - CLANG_WARN_INT_CONVERSION = YES; | ||
| 290 | - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; | ||
| 291 | - CLANG_WARN_SUSPICIOUS_MOVES = YES; | ||
| 292 | - CLANG_WARN_UNREACHABLE_CODE = YES; | ||
| 293 | - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; | ||
| 294 | - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; | ||
| 295 | - COPY_PHASE_STRIP = NO; | ||
| 296 | - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; | ||
| 297 | - ENABLE_NS_ASSERTIONS = NO; | ||
| 298 | - ENABLE_STRICT_OBJC_MSGSEND = YES; | ||
| 299 | - GCC_C_LANGUAGE_STANDARD = gnu99; | ||
| 300 | - GCC_NO_COMMON_BLOCKS = YES; | ||
| 301 | - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; | ||
| 302 | - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; | ||
| 303 | - GCC_WARN_UNDECLARED_SELECTOR = YES; | ||
| 304 | - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; | ||
| 305 | - GCC_WARN_UNUSED_FUNCTION = YES; | ||
| 306 | - GCC_WARN_UNUSED_VARIABLE = YES; | ||
| 307 | - IPHONEOS_DEPLOYMENT_TARGET = 10.0; | ||
| 308 | - MTL_ENABLE_DEBUG_INFO = NO; | ||
| 309 | - SDKROOT = iphoneos; | ||
| 310 | - VALIDATE_PRODUCT = YES; | ||
| 311 | - }; | ||
| 312 | - name = Release; | ||
| 313 | - }; | ||
| 314 | - 327977D61D9BBF1D00679858 /* Debug */ = { | ||
| 315 | - isa = XCBuildConfiguration; | ||
| 316 | - buildSettings = { | ||
| 317 | - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; | ||
| 318 | - DEVELOPMENT_TEAM = 94X49GG3ZW; | ||
| 319 | - ENABLE_BITCODE = NO; | ||
| 320 | - FRAMEWORK_SEARCH_PATHS = ( | ||
| 321 | - "$(inherited)", | ||
| 322 | - "$(PROJECT_DIR)", | ||
| 323 | - ); | ||
| 324 | - INFOPLIST_FILE = CNLiveXMPPManagerDemo/Info.plist; | ||
| 325 | - IPHONEOS_DEPLOYMENT_TARGET = 8.0; | ||
| 326 | - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; | ||
| 327 | - PRODUCT_BUNDLE_IDENTIFIER = com.cnlive.chat; | ||
| 328 | - PRODUCT_NAME = "$(TARGET_NAME)"; | ||
| 329 | - }; | ||
| 330 | - name = Debug; | ||
| 331 | - }; | ||
| 332 | - 327977D71D9BBF1D00679858 /* Release */ = { | ||
| 333 | - isa = XCBuildConfiguration; | ||
| 334 | - buildSettings = { | ||
| 335 | - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; | ||
| 336 | - DEVELOPMENT_TEAM = 94X49GG3ZW; | ||
| 337 | - ENABLE_BITCODE = NO; | ||
| 338 | - FRAMEWORK_SEARCH_PATHS = ( | ||
| 339 | - "$(inherited)", | ||
| 340 | - "$(PROJECT_DIR)", | ||
| 341 | - ); | ||
| 342 | - INFOPLIST_FILE = CNLiveXMPPManagerDemo/Info.plist; | ||
| 343 | - IPHONEOS_DEPLOYMENT_TARGET = 8.0; | ||
| 344 | - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; | ||
| 345 | - PRODUCT_BUNDLE_IDENTIFIER = com.cnlive.chat; | ||
| 346 | - PRODUCT_NAME = "$(TARGET_NAME)"; | ||
| 347 | - }; | ||
| 348 | - name = Release; | ||
| 349 | - }; | ||
| 350 | -/* End XCBuildConfiguration section */ | ||
| 351 | - | ||
| 352 | -/* Begin XCConfigurationList section */ | ||
| 353 | - 327977B91D9BBF1D00679858 /* Build configuration list for PBXProject "CNLiveXMPPManagerDemo" */ = { | ||
| 354 | - isa = XCConfigurationList; | ||
| 355 | - buildConfigurations = ( | ||
| 356 | - 327977D31D9BBF1D00679858 /* Debug */, | ||
| 357 | - 327977D41D9BBF1D00679858 /* Release */, | ||
| 358 | - ); | ||
| 359 | - defaultConfigurationIsVisible = 0; | ||
| 360 | - defaultConfigurationName = Release; | ||
| 361 | - }; | ||
| 362 | - 327977D51D9BBF1D00679858 /* Build configuration list for PBXNativeTarget "CNLiveXMPPManagerDemo" */ = { | ||
| 363 | - isa = XCConfigurationList; | ||
| 364 | - buildConfigurations = ( | ||
| 365 | - 327977D61D9BBF1D00679858 /* Debug */, | ||
| 366 | - 327977D71D9BBF1D00679858 /* Release */, | ||
| 367 | - ); | ||
| 368 | - defaultConfigurationIsVisible = 0; | ||
| 369 | - defaultConfigurationName = Release; | ||
| 370 | - }; | ||
| 371 | -/* End XCConfigurationList section */ | ||
| 372 | - }; | ||
| 373 | - rootObject = 327977B61D9BBF1D00679858 /* Project object */; | ||
| 374 | -} |
CNLiveXMPPManagerDemo/CNLiveXMPPManagerDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted
100644 → 0
CNLiveXMPPManagerDemo/CNLiveXMPPManagerDemo.xcodeproj/xcuserdata/leihaojie.xcuserdatad/xcschemes/CNLiveXMPPManagerDemo.xcscheme deleted
100644 → 0
| 1 | -<?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | -<Scheme | ||
| 3 | - LastUpgradeVersion = "0800" | ||
| 4 | - version = "1.3"> | ||
| 5 | - <BuildAction | ||
| 6 | - parallelizeBuildables = "YES" | ||
| 7 | - buildImplicitDependencies = "YES"> | ||
| 8 | - <BuildActionEntries> | ||
| 9 | - <BuildActionEntry | ||
| 10 | - buildForTesting = "YES" | ||
| 11 | - buildForRunning = "YES" | ||
| 12 | - buildForProfiling = "YES" | ||
| 13 | - buildForArchiving = "YES" | ||
| 14 | - buildForAnalyzing = "YES"> | ||
| 15 | - <BuildableReference | ||
| 16 | - BuildableIdentifier = "primary" | ||
| 17 | - BlueprintIdentifier = "327977BD1D9BBF1D00679858" | ||
| 18 | - BuildableName = "CNLiveXMPPManagerDemo.app" | ||
| 19 | - BlueprintName = "CNLiveXMPPManagerDemo" | ||
| 20 | - ReferencedContainer = "container:CNLiveXMPPManagerDemo.xcodeproj"> | ||
| 21 | - </BuildableReference> | ||
| 22 | - </BuildActionEntry> | ||
| 23 | - </BuildActionEntries> | ||
| 24 | - </BuildAction> | ||
| 25 | - <TestAction | ||
| 26 | - buildConfiguration = "Debug" | ||
| 27 | - selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | ||
| 28 | - selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | ||
| 29 | - shouldUseLaunchSchemeArgsEnv = "YES"> | ||
| 30 | - <Testables> | ||
| 31 | - </Testables> | ||
| 32 | - <MacroExpansion> | ||
| 33 | - <BuildableReference | ||
| 34 | - BuildableIdentifier = "primary" | ||
| 35 | - BlueprintIdentifier = "327977BD1D9BBF1D00679858" | ||
| 36 | - BuildableName = "CNLiveXMPPManagerDemo.app" | ||
| 37 | - BlueprintName = "CNLiveXMPPManagerDemo" | ||
| 38 | - ReferencedContainer = "container:CNLiveXMPPManagerDemo.xcodeproj"> | ||
| 39 | - </BuildableReference> | ||
| 40 | - </MacroExpansion> | ||
| 41 | - <AdditionalOptions> | ||
| 42 | - </AdditionalOptions> | ||
| 43 | - </TestAction> | ||
| 44 | - <LaunchAction | ||
| 45 | - buildConfiguration = "Debug" | ||
| 46 | - selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | ||
| 47 | - selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | ||
| 48 | - launchStyle = "0" | ||
| 49 | - useCustomWorkingDirectory = "NO" | ||
| 50 | - ignoresPersistentStateOnLaunch = "NO" | ||
| 51 | - debugDocumentVersioning = "YES" | ||
| 52 | - debugServiceExtension = "internal" | ||
| 53 | - allowLocationSimulation = "YES"> | ||
| 54 | - <BuildableProductRunnable | ||
| 55 | - runnableDebuggingMode = "0"> | ||
| 56 | - <BuildableReference | ||
| 57 | - BuildableIdentifier = "primary" | ||
| 58 | - BlueprintIdentifier = "327977BD1D9BBF1D00679858" | ||
| 59 | - BuildableName = "CNLiveXMPPManagerDemo.app" | ||
| 60 | - BlueprintName = "CNLiveXMPPManagerDemo" | ||
| 61 | - ReferencedContainer = "container:CNLiveXMPPManagerDemo.xcodeproj"> | ||
| 62 | - </BuildableReference> | ||
| 63 | - </BuildableProductRunnable> | ||
| 64 | - <AdditionalOptions> | ||
| 65 | - </AdditionalOptions> | ||
| 66 | - </LaunchAction> | ||
| 67 | - <ProfileAction | ||
| 68 | - buildConfiguration = "Release" | ||
| 69 | - shouldUseLaunchSchemeArgsEnv = "YES" | ||
| 70 | - savedToolIdentifier = "" | ||
| 71 | - useCustomWorkingDirectory = "NO" | ||
| 72 | - debugDocumentVersioning = "YES"> | ||
| 73 | - <BuildableProductRunnable | ||
| 74 | - runnableDebuggingMode = "0"> | ||
| 75 | - <BuildableReference | ||
| 76 | - BuildableIdentifier = "primary" | ||
| 77 | - BlueprintIdentifier = "327977BD1D9BBF1D00679858" | ||
| 78 | - BuildableName = "CNLiveXMPPManagerDemo.app" | ||
| 79 | - BlueprintName = "CNLiveXMPPManagerDemo" | ||
| 80 | - ReferencedContainer = "container:CNLiveXMPPManagerDemo.xcodeproj"> | ||
| 81 | - </BuildableReference> | ||
| 82 | - </BuildableProductRunnable> | ||
| 83 | - </ProfileAction> | ||
| 84 | - <AnalyzeAction | ||
| 85 | - buildConfiguration = "Debug"> | ||
| 86 | - </AnalyzeAction> | ||
| 87 | - <ArchiveAction | ||
| 88 | - buildConfiguration = "Release" | ||
| 89 | - revealArchiveInOrganizer = "YES"> | ||
| 90 | - </ArchiveAction> | ||
| 91 | -</Scheme> |
CNLiveXMPPManagerDemo/CNLiveXMPPManagerDemo.xcodeproj/xcuserdata/leihaojie.xcuserdatad/xcschemes/xcschememanagement.plist deleted
100644 → 0
| 1 | -<?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
| 3 | -<plist version="1.0"> | ||
| 4 | -<dict> | ||
| 5 | - <key>SchemeUserState</key> | ||
| 6 | - <dict> | ||
| 7 | - <key>CNLiveXMPPManagerDemo.xcscheme</key> | ||
| 8 | - <dict> | ||
| 9 | - <key>orderHint</key> | ||
| 10 | - <integer>0</integer> | ||
| 11 | - </dict> | ||
| 12 | - </dict> | ||
| 13 | - <key>SuppressBuildableAutocreation</key> | ||
| 14 | - <dict> | ||
| 15 | - <key>327977BD1D9BBF1D00679858</key> | ||
| 16 | - <dict> | ||
| 17 | - <key>primary</key> | ||
| 18 | - <true/> | ||
| 19 | - </dict> | ||
| 20 | - </dict> | ||
| 21 | -</dict> | ||
| 22 | -</plist> |
CNLiveXMPPManagerDemo/CNLiveXMPPManagerDemo/AppDelegate.h deleted
100644 → 0
| 1 | -// | ||
| 2 | -// AppDelegate.h | ||
| 3 | -// CNLiveXMPPManagerDemo | ||
| 4 | -// | ||
| 5 | -// Created by 雷浩杰 on 16/9/28. | ||
| 6 | -// Copyright © 2016年 雷浩杰. All rights reserved. | ||
| 7 | -// | ||
| 8 | - | ||
| 9 | -#import <UIKit/UIKit.h> | ||
| 10 | - | ||
| 11 | -@interface AppDelegate : UIResponder <UIApplicationDelegate> | ||
| 12 | - | ||
| 13 | -@property (strong, nonatomic) UIWindow *window; | ||
| 14 | - | ||
| 15 | - | ||
| 16 | -@end | ||
| 17 | - |
CNLiveXMPPManagerDemo/CNLiveXMPPManagerDemo/AppDelegate.m deleted
100644 → 0
| 1 | -// | ||
| 2 | -// AppDelegate.m | ||
| 3 | -// CNLiveXMPPManagerDemo | ||
| 4 | -// | ||
| 5 | -// Created by 雷浩杰 on 16/9/28. | ||
| 6 | -// Copyright © 2016年 雷浩杰. All rights reserved. | ||
| 7 | -// | ||
| 8 | - | ||
| 9 | -#import "AppDelegate.h" | ||
| 10 | - | ||
| 11 | -@interface AppDelegate () | ||
| 12 | - | ||
| 13 | -@end | ||
| 14 | - | ||
| 15 | -@implementation AppDelegate | ||
| 16 | - | ||
| 17 | - | ||
| 18 | -- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { | ||
| 19 | - // Override point for customization after application launch. | ||
| 20 | - return YES; | ||
| 21 | -} | ||
| 22 | - | ||
| 23 | - | ||
| 24 | -- (void)applicationWillResignActive:(UIApplication *)application { | ||
| 25 | - // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. | ||
| 26 | - // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. | ||
| 27 | -} | ||
| 28 | - | ||
| 29 | - | ||
| 30 | -- (void)applicationDidEnterBackground:(UIApplication *)application { | ||
| 31 | - // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. | ||
| 32 | - // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. | ||
| 33 | -} | ||
| 34 | - | ||
| 35 | - | ||
| 36 | -- (void)applicationWillEnterForeground:(UIApplication *)application { | ||
| 37 | - // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. | ||
| 38 | -} | ||
| 39 | - | ||
| 40 | - | ||
| 41 | -- (void)applicationDidBecomeActive:(UIApplication *)application { | ||
| 42 | - // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. | ||
| 43 | -} | ||
| 44 | - | ||
| 45 | - | ||
| 46 | -- (void)applicationWillTerminate:(UIApplication *)application { | ||
| 47 | - // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. | ||
| 48 | -} | ||
| 49 | - | ||
| 50 | - | ||
| 51 | -@end |
CNLiveXMPPManagerDemo/CNLiveXMPPManagerDemo/Assets.xcassets/AppIcon.appiconset/Contents.json deleted
100644 → 0
| 1 | -{ | ||
| 2 | - "images" : [ | ||
| 3 | - { | ||
| 4 | - "idiom" : "iphone", | ||
| 5 | - "size" : "20x20", | ||
| 6 | - "scale" : "2x" | ||
| 7 | - }, | ||
| 8 | - { | ||
| 9 | - "idiom" : "iphone", | ||
| 10 | - "size" : "20x20", | ||
| 11 | - "scale" : "3x" | ||
| 12 | - }, | ||
| 13 | - { | ||
| 14 | - "idiom" : "iphone", | ||
| 15 | - "size" : "29x29", | ||
| 16 | - "scale" : "2x" | ||
| 17 | - }, | ||
| 18 | - { | ||
| 19 | - "idiom" : "iphone", | ||
| 20 | - "size" : "29x29", | ||
| 21 | - "scale" : "3x" | ||
| 22 | - }, | ||
| 23 | - { | ||
| 24 | - "idiom" : "iphone", | ||
| 25 | - "size" : "40x40", | ||
| 26 | - "scale" : "2x" | ||
| 27 | - }, | ||
| 28 | - { | ||
| 29 | - "idiom" : "iphone", | ||
| 30 | - "size" : "40x40", | ||
| 31 | - "scale" : "3x" | ||
| 32 | - }, | ||
| 33 | - { | ||
| 34 | - "idiom" : "iphone", | ||
| 35 | - "size" : "60x60", | ||
| 36 | - "scale" : "2x" | ||
| 37 | - }, | ||
| 38 | - { | ||
| 39 | - "idiom" : "iphone", | ||
| 40 | - "size" : "60x60", | ||
| 41 | - "scale" : "3x" | ||
| 42 | - } | ||
| 43 | - ], | ||
| 44 | - "info" : { | ||
| 45 | - "version" : 1, | ||
| 46 | - "author" : "xcode" | ||
| 47 | - } | ||
| 48 | -} | ||
| 49 | \ No newline at end of file | 0 | \ No newline at end of file |
CNLiveXMPPManagerDemo/CNLiveXMPPManagerDemo/Base.lproj/LaunchScreen.storyboard deleted
100644 → 0
| 1 | -<?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
| 2 | -<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11134" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="01J-lp-oVM"> | ||
| 3 | - <dependencies> | ||
| 4 | - <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11106"/> | ||
| 5 | - <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> | ||
| 6 | - </dependencies> | ||
| 7 | - <scenes> | ||
| 8 | - <!--View Controller--> | ||
| 9 | - <scene sceneID="EHf-IW-A2E"> | ||
| 10 | - <objects> | ||
| 11 | - <viewController id="01J-lp-oVM" sceneMemberID="viewController"> | ||
| 12 | - <layoutGuides> | ||
| 13 | - <viewControllerLayoutGuide type="top" id="Llm-lL-Icb"/> | ||
| 14 | - <viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok"/> | ||
| 15 | - </layoutGuides> | ||
| 16 | - <view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3"> | ||
| 17 | - <rect key="frame" x="0.0" y="0.0" width="375" height="667"/> | ||
| 18 | - <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> | ||
| 19 | - <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> | ||
| 20 | - </view> | ||
| 21 | - </viewController> | ||
| 22 | - <placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/> | ||
| 23 | - </objects> | ||
| 24 | - <point key="canvasLocation" x="53" y="375"/> | ||
| 25 | - </scene> | ||
| 26 | - </scenes> | ||
| 27 | -</document> |
CNLiveXMPPManagerDemo/CNLiveXMPPManagerDemo/Base.lproj/Main.storyboard deleted
100644 → 0
| 1 | -<?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | -<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11762" systemVersion="16D32" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="06n-aH-okM"> | ||
| 3 | - <device id="retina4_7" orientation="portrait"> | ||
| 4 | - <adaptation id="fullscreen"/> | ||
| 5 | - </device> | ||
| 6 | - <dependencies> | ||
| 7 | - <deployment identifier="iOS"/> | ||
| 8 | - <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/> | ||
| 9 | - <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> | ||
| 10 | - </dependencies> | ||
| 11 | - <scenes> | ||
| 12 | - <!--互动云 聊天室SDK Demo--> | ||
| 13 | - <scene sceneID="tne-QT-ifu"> | ||
| 14 | - <objects> | ||
| 15 | - <viewController id="BYZ-38-t0r" customClass="ViewController" sceneMemberID="viewController"> | ||
| 16 | - <layoutGuides> | ||
| 17 | - <viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/> | ||
| 18 | - <viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/> | ||
| 19 | - </layoutGuides> | ||
| 20 | - <view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC"> | ||
| 21 | - <rect key="frame" x="0.0" y="0.0" width="375" height="667"/> | ||
| 22 | - <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> | ||
| 23 | - <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> | ||
| 24 | - </view> | ||
| 25 | - <navigationItem key="navigationItem" title="互动云 聊天室SDK Demo" id="BWk-fb-LQT"/> | ||
| 26 | - </viewController> | ||
| 27 | - <placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/> | ||
| 28 | - </objects> | ||
| 29 | - <point key="canvasLocation" x="964" y="36.431784107946029"/> | ||
| 30 | - </scene> | ||
| 31 | - <!--Navigation Controller--> | ||
| 32 | - <scene sceneID="AHB-iF-bKU"> | ||
| 33 | - <objects> | ||
| 34 | - <navigationController automaticallyAdjustsScrollViewInsets="NO" id="06n-aH-okM" sceneMemberID="viewController"> | ||
| 35 | - <toolbarItems/> | ||
| 36 | - <navigationBar key="navigationBar" contentMode="scaleToFill" id="ZOL-0v-2oc"> | ||
| 37 | - <rect key="frame" x="0.0" y="0.0" width="375" height="44"/> | ||
| 38 | - <autoresizingMask key="autoresizingMask"/> | ||
| 39 | - </navigationBar> | ||
| 40 | - <nil name="viewControllers"/> | ||
| 41 | - <connections> | ||
| 42 | - <segue destination="BYZ-38-t0r" kind="relationship" relationship="rootViewController" id="fMx-a7-zk6"/> | ||
| 43 | - </connections> | ||
| 44 | - </navigationController> | ||
| 45 | - <placeholder placeholderIdentifier="IBFirstResponder" id="AKz-aK-FZ7" userLabel="First Responder" sceneMemberID="firstResponder"/> | ||
| 46 | - </objects> | ||
| 47 | - <point key="canvasLocation" x="116" y="-646.32683658170924"/> | ||
| 48 | - </scene> | ||
| 49 | - </scenes> | ||
| 50 | -</document> |
CNLiveXMPPManagerDemo/CNLiveXMPPManagerDemo/Info.plist deleted
100644 → 0
| 1 | -<?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
| 3 | -<plist version="1.0"> | ||
| 4 | -<dict> | ||
| 5 | - <key>CFBundleDevelopmentRegion</key> | ||
| 6 | - <string>en</string> | ||
| 7 | - <key>CFBundleExecutable</key> | ||
| 8 | - <string>$(EXECUTABLE_NAME)</string> | ||
| 9 | - <key>CFBundleIdentifier</key> | ||
| 10 | - <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> | ||
| 11 | - <key>CFBundleInfoDictionaryVersion</key> | ||
| 12 | - <string>6.0</string> | ||
| 13 | - <key>CFBundleName</key> | ||
| 14 | - <string>$(PRODUCT_NAME)</string> | ||
| 15 | - <key>CFBundlePackageType</key> | ||
| 16 | - <string>APPL</string> | ||
| 17 | - <key>CFBundleShortVersionString</key> | ||
| 18 | - <string>1.0</string> | ||
| 19 | - <key>CFBundleVersion</key> | ||
| 20 | - <string>1</string> | ||
| 21 | - <key>LSRequiresIPhoneOS</key> | ||
| 22 | - <true/> | ||
| 23 | - <key>NSAppTransportSecurity</key> | ||
| 24 | - <dict> | ||
| 25 | - <key>NSAllowsArbitraryLoads</key> | ||
| 26 | - <true/> | ||
| 27 | - </dict> | ||
| 28 | - <key>UILaunchStoryboardName</key> | ||
| 29 | - <string>LaunchScreen</string> | ||
| 30 | - <key>UIMainStoryboardFile</key> | ||
| 31 | - <string>Main</string> | ||
| 32 | - <key>UIRequiredDeviceCapabilities</key> | ||
| 33 | - <array> | ||
| 34 | - <string>armv7</string> | ||
| 35 | - </array> | ||
| 36 | - <key>UISupportedInterfaceOrientations</key> | ||
| 37 | - <array> | ||
| 38 | - <string>UIInterfaceOrientationPortrait</string> | ||
| 39 | - <string>UIInterfaceOrientationLandscapeLeft</string> | ||
| 40 | - <string>UIInterfaceOrientationLandscapeRight</string> | ||
| 41 | - </array> | ||
| 42 | -</dict> | ||
| 43 | -</plist> |
CNLiveXMPPManagerDemo/CNLiveXMPPManagerDemo/ViewController.h deleted
100644 → 0
CNLiveXMPPManagerDemo/CNLiveXMPPManagerDemo/ViewController.m deleted
100644 → 0
| 1 | -// | ||
| 2 | -// ViewController.m | ||
| 3 | -// CNLiveXMPPManagerDemo | ||
| 4 | -// | ||
| 5 | -// Created by 雷浩杰 on 16/9/28. | ||
| 6 | -// Copyright © 2016年 雷浩杰. All rights reserved. | ||
| 7 | -// | ||
| 8 | - | ||
| 9 | -#import "ViewController.h" | ||
| 10 | - | ||
| 11 | -#import <CNLiveXMPPSDK/CNLiveXMPPManager.h> | ||
| 12 | - | ||
| 13 | -#define ScreenWidth ([UIScreen mainScreen].bounds.size.width) | ||
| 14 | -#define ScreenHeight ([UIScreen mainScreen].bounds.size.height) | ||
| 15 | -#define ButtonWidth (ScreenWidth / 4) | ||
| 16 | - | ||
| 17 | -#define KAppId @"60_irn9cdak77" | ||
| 18 | -#define KAppKey @"a425987ebc86e352b3373c25d5bd082d0cc248b4043028" | ||
| 19 | -#define KRoomId @"60_cnlivetest" | ||
| 20 | - | ||
| 21 | -@interface ViewController ()<XMPPManagerDelegate> | ||
| 22 | - | ||
| 23 | -@property (nonatomic, strong) CNLiveXMPPManager *manager; | ||
| 24 | -@property (nonatomic, strong) UIButton *button; | ||
| 25 | -@property (nonatomic, strong) UIButton *leaveRoomBtn; | ||
| 26 | -@property (nonatomic, strong) UIButton *disconnectXmppBtn; | ||
| 27 | -@property (nonatomic, strong) UIButton *reconnectBtn; | ||
| 28 | -@property (nonatomic, strong) UIButton *rejoinChatroomBtn; | ||
| 29 | -@property (nonatomic, strong) UIButton *changeNickBtn; | ||
| 30 | -@property (nonatomic, strong) UITextField *textField; | ||
| 31 | -@property (nonatomic, strong) UITextView *textView; | ||
| 32 | -@property (nonatomic, strong) NSMutableString *mutableStr; | ||
| 33 | -@property (nonatomic, copy) NSString *nickStr; | ||
| 34 | - | ||
| 35 | -@end | ||
| 36 | - | ||
| 37 | -@implementation ViewController | ||
| 38 | - | ||
| 39 | -- (void)viewDidLoad { | ||
| 40 | - [super viewDidLoad]; | ||
| 41 | - | ||
| 42 | - // Do any additional setup after loading the view, typically from a nib. | ||
| 43 | - [self.view addSubview:self.button]; | ||
| 44 | - [self.view addSubview:self.leaveRoomBtn]; | ||
| 45 | - [self.view addSubview:self.disconnectXmppBtn]; | ||
| 46 | - [self.view addSubview:self.reconnectBtn]; | ||
| 47 | - [self.view addSubview:self.rejoinChatroomBtn]; | ||
| 48 | - [self.view addSubview:self.changeNickBtn]; | ||
| 49 | - [self.view addSubview:self.textField]; | ||
| 50 | - [self.view addSubview:self.textView]; | ||
| 51 | - self.nickStr = @"CNLiveChatTest1"; | ||
| 52 | - [self.manager joinRoomWithNickName:self.nickStr]; | ||
| 53 | - | ||
| 54 | - UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(textFieldResignFirstResponder)]; | ||
| 55 | - [self.view addGestureRecognizer:tap]; | ||
| 56 | - | ||
| 57 | - UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, CGRectGetHeight([UIScreen mainScreen].bounds)-40, CGRectGetWidth(self.view.frame), 30)]; | ||
| 58 | - label.text = @"北京中投视讯文化传媒股份有限公司"; | ||
| 59 | - [self.view addSubview:label]; | ||
| 60 | - label.font = [UIFont systemFontOfSize:12]; | ||
| 61 | - label.textAlignment = NSTextAlignmentCenter; | ||
| 62 | -} | ||
| 63 | - | ||
| 64 | -- (UITextField *)textField | ||
| 65 | -{ | ||
| 66 | - if (!_textField) { | ||
| 67 | - _textField = [[UITextField alloc] initWithFrame:CGRectMake(0, 154, ScreenWidth, 40)]; | ||
| 68 | - _textField.borderStyle = UITextBorderStyleLine; | ||
| 69 | - } | ||
| 70 | - return _textField; | ||
| 71 | -} | ||
| 72 | - | ||
| 73 | -- (UIButton *)button | ||
| 74 | -{ | ||
| 75 | - if (!_button) { | ||
| 76 | - _button = [UIButton buttonWithType:UIButtonTypeCustom]; | ||
| 77 | - [_button setFrame:CGRectMake(40, 204, 100, 30)]; | ||
| 78 | - [_button setTitleColor:[UIColor colorWithRed:23/255.0 green:110/255.0 blue:254/255.0 alpha:1] forState:UIControlStateNormal]; | ||
| 79 | - [_button setTitle:@"发送" forState:UIControlStateNormal]; | ||
| 80 | - _button.tag = 10001; | ||
| 81 | - [_button addTarget:self action:@selector(buttonAction:) forControlEvents:UIControlEventTouchUpInside]; | ||
| 82 | - [self setButtonBorder:_button]; | ||
| 83 | - } | ||
| 84 | - return _button; | ||
| 85 | -} | ||
| 86 | - | ||
| 87 | -- (UIButton *)changeNickBtn | ||
| 88 | -{ | ||
| 89 | - if (!_changeNickBtn) { | ||
| 90 | - _changeNickBtn = [UIButton buttonWithType:UIButtonTypeCustom]; | ||
| 91 | - [_changeNickBtn setFrame:CGRectMake(ScreenWidth-140, 204, 100, 30)]; | ||
| 92 | - [_changeNickBtn setTitle:@"更改昵称" forState:UIControlStateNormal]; | ||
| 93 | - [_changeNickBtn setTitleColor:[UIColor colorWithRed:23/255.0 green:110/255.0 blue:254/255.0 alpha:1] forState:UIControlStateNormal]; | ||
| 94 | - _changeNickBtn.tag = 10002; | ||
| 95 | - [_changeNickBtn addTarget:self action:@selector(buttonAction:) forControlEvents:UIControlEventTouchUpInside]; | ||
| 96 | - [self setButtonBorder:_changeNickBtn]; | ||
| 97 | - } | ||
| 98 | - return _changeNickBtn; | ||
| 99 | -} | ||
| 100 | - | ||
| 101 | -- (UIButton *)leaveRoomBtn | ||
| 102 | -{ | ||
| 103 | - if (!_leaveRoomBtn) { | ||
| 104 | - _leaveRoomBtn = [UIButton buttonWithType:UIButtonTypeCustom]; | ||
| 105 | - [_leaveRoomBtn setFrame:CGRectMake(ScreenWidth-150, 74, 120, 30)]; | ||
| 106 | - [_leaveRoomBtn setTitle:@"离开聊天室" forState:UIControlStateNormal]; | ||
| 107 | - [_leaveRoomBtn setTitleColor:[UIColor colorWithRed:23/255.0 green:110/255.0 blue:254/255.0 alpha:1] forState:UIControlStateNormal]; | ||
| 108 | - [_leaveRoomBtn.titleLabel setAdjustsFontSizeToFitWidth:YES]; | ||
| 109 | - _leaveRoomBtn.tag = 10003; | ||
| 110 | - [_leaveRoomBtn addTarget:self action:@selector(buttonAction:) forControlEvents:UIControlEventTouchUpInside]; | ||
| 111 | - [self setButtonBorder:_leaveRoomBtn]; | ||
| 112 | - } | ||
| 113 | - return _leaveRoomBtn; | ||
| 114 | -} | ||
| 115 | - | ||
| 116 | -- (UIButton *)disconnectXmppBtn | ||
| 117 | -{ | ||
| 118 | - if (!_disconnectXmppBtn) { | ||
| 119 | - _disconnectXmppBtn = [UIButton buttonWithType:UIButtonTypeCustom]; | ||
| 120 | - [_disconnectXmppBtn setFrame:CGRectMake(30, 74, 120, 30)]; | ||
| 121 | - [_disconnectXmppBtn setTitle:@"断开XMPP" forState:UIControlStateNormal]; | ||
| 122 | - [_disconnectXmppBtn setTitleColor:[UIColor colorWithRed:23/255.0 green:110/255.0 blue:254/255.0 alpha:1] forState:UIControlStateNormal]; | ||
| 123 | - [_disconnectXmppBtn.titleLabel setAdjustsFontSizeToFitWidth:YES]; | ||
| 124 | - _disconnectXmppBtn.tag = 10004; | ||
| 125 | - [_disconnectXmppBtn addTarget:self action:@selector(buttonAction:) forControlEvents:UIControlEventTouchUpInside]; | ||
| 126 | - [self setButtonBorder:_disconnectXmppBtn]; | ||
| 127 | - } | ||
| 128 | - return _disconnectXmppBtn; | ||
| 129 | -} | ||
| 130 | - | ||
| 131 | -- (UIButton *)reconnectBtn | ||
| 132 | -{ | ||
| 133 | - if (!_reconnectBtn) { | ||
| 134 | - _reconnectBtn = [UIButton buttonWithType:UIButtonTypeCustom]; | ||
| 135 | - [_reconnectBtn setFrame:CGRectMake(30, 114, 120, 30)]; | ||
| 136 | - [_reconnectBtn setTitle:@"重连XMPP" forState:UIControlStateNormal]; | ||
| 137 | - [_reconnectBtn setTitleColor:[UIColor colorWithRed:23/255.0 green:110/255.0 blue:254/255.0 alpha:1] forState:UIControlStateNormal]; | ||
| 138 | - [_reconnectBtn.titleLabel setAdjustsFontSizeToFitWidth:YES]; | ||
| 139 | - _reconnectBtn.tag = 10005; | ||
| 140 | - [_reconnectBtn addTarget:self action:@selector(buttonAction:) forControlEvents:UIControlEventTouchUpInside]; | ||
| 141 | - [self setButtonBorder:_reconnectBtn]; | ||
| 142 | - } | ||
| 143 | - return _reconnectBtn; | ||
| 144 | -} | ||
| 145 | - | ||
| 146 | -- (UIButton *)rejoinChatroomBtn | ||
| 147 | -{ | ||
| 148 | - if (!_rejoinChatroomBtn) { | ||
| 149 | - _rejoinChatroomBtn = [UIButton buttonWithType:UIButtonTypeCustom]; | ||
| 150 | - [_rejoinChatroomBtn setFrame:CGRectMake(ScreenWidth-150, 114, 120, 30)]; | ||
| 151 | - [_rejoinChatroomBtn setTitle:@"重连聊天室" forState:UIControlStateNormal]; | ||
| 152 | - [_rejoinChatroomBtn setTitleColor:[UIColor colorWithRed:23/255.0 green:110/255.0 blue:254/255.0 alpha:1] forState:UIControlStateNormal]; | ||
| 153 | - [_rejoinChatroomBtn.titleLabel setAdjustsFontSizeToFitWidth:YES]; | ||
| 154 | - _rejoinChatroomBtn.tag = 10006; | ||
| 155 | - [_rejoinChatroomBtn addTarget:self action:@selector(buttonAction:) forControlEvents:UIControlEventTouchUpInside]; | ||
| 156 | - [self setButtonBorder:_rejoinChatroomBtn]; | ||
| 157 | - } | ||
| 158 | - return _rejoinChatroomBtn; | ||
| 159 | -} | ||
| 160 | - | ||
| 161 | -- (void)setButtonBorder:(UIButton *)button | ||
| 162 | -{ | ||
| 163 | - button.layer.borderWidth = 1; | ||
| 164 | - button.layer.borderColor = [UIColor blackColor].CGColor; | ||
| 165 | - button.layer.cornerRadius = 15; | ||
| 166 | - button.layer.masksToBounds = YES; | ||
| 167 | -} | ||
| 168 | - | ||
| 169 | -- (UITextView *)textView | ||
| 170 | -{ | ||
| 171 | - if (!_textView) { | ||
| 172 | - _textView = [[UITextView alloc] initWithFrame:CGRectMake(0, 244, ScreenWidth, ScreenHeight-294)]; | ||
| 173 | - _textView.editable = NO; | ||
| 174 | - _textView.layer.borderWidth = 1; | ||
| 175 | - _textView.layer.borderColor = [UIColor blackColor].CGColor; | ||
| 176 | - } | ||
| 177 | - return _textView; | ||
| 178 | -} | ||
| 179 | - | ||
| 180 | -- (NSMutableString *)mutableStr | ||
| 181 | -{ | ||
| 182 | - if (!_mutableStr) { | ||
| 183 | - _mutableStr = [NSMutableString stringWithCapacity:0]; | ||
| 184 | - } | ||
| 185 | - return _mutableStr; | ||
| 186 | -} | ||
| 187 | - | ||
| 188 | -- (void)textFieldResignFirstResponder | ||
| 189 | -{ | ||
| 190 | - [self.textField resignFirstResponder]; | ||
| 191 | -} | ||
| 192 | - | ||
| 193 | -- (void)buttonAction:(UIButton *)button | ||
| 194 | -{ | ||
| 195 | - switch (button.tag) { | ||
| 196 | - case 10001: | ||
| 197 | - { | ||
| 198 | - NSDictionary *dic = @{@"name":self.nickStr,@"content":self.textField.text}; | ||
| 199 | - [self.manager sendMessage:[self dictionaryToJson:dic]]; | ||
| 200 | - self.textField.text = @""; | ||
| 201 | - [self.textField resignFirstResponder]; | ||
| 202 | - } | ||
| 203 | - break; | ||
| 204 | - case 10002: | ||
| 205 | - { | ||
| 206 | - self.nickStr = self.textField.text; | ||
| 207 | - [self.manager changeNickname:self.textField.text]; | ||
| 208 | - self.textField.text = @""; | ||
| 209 | - [self.textField resignFirstResponder]; | ||
| 210 | - } | ||
| 211 | - break; | ||
| 212 | - case 10003: | ||
| 213 | - { | ||
| 214 | - [self.manager leaveRoom]; | ||
| 215 | - } | ||
| 216 | - break; | ||
| 217 | - case 10004: | ||
| 218 | - { | ||
| 219 | - [self.manager disconnect]; | ||
| 220 | - } | ||
| 221 | - break; | ||
| 222 | - case 10005: | ||
| 223 | - { | ||
| 224 | - [self.manager reconnection]; | ||
| 225 | - } | ||
| 226 | - break; | ||
| 227 | - case 10006: | ||
| 228 | - { | ||
| 229 | - [self.manager joinRoomWithNickName:self.nickStr]; | ||
| 230 | - } | ||
| 231 | - break; | ||
| 232 | - default: | ||
| 233 | - break; | ||
| 234 | - } | ||
| 235 | -} | ||
| 236 | -- (NSString *)dictionaryToJson:(NSDictionary *)dic | ||
| 237 | -{ | ||
| 238 | - NSError *parseError = nil; | ||
| 239 | - NSData *jsonData = [NSJSONSerialization dataWithJSONObject:dic options:NSJSONWritingPrettyPrinted error:&parseError]; | ||
| 240 | - return [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]; | ||
| 241 | -} | ||
| 242 | -- (CNLiveXMPPManager *)manager | ||
| 243 | -{ | ||
| 244 | - if (!_manager) { | ||
| 245 | - _manager = [[CNLiveXMPPManager alloc] initWithChatRoomId:KRoomId appId:KAppId app_key:KAppKey autoReconnect:NO]; | ||
| 246 | - _manager.receiveHistory = YES; | ||
| 247 | - _manager.delegate = self; | ||
| 248 | - } | ||
| 249 | - return _manager; | ||
| 250 | -} | ||
| 251 | - | ||
| 252 | -- (void)connectXmppSuccess | ||
| 253 | -{ | ||
| 254 | - NSLog(@"connectXmppSuccess"); | ||
| 255 | - [self reloadMessage:@"connectXmppSuccess"]; | ||
| 256 | - | ||
| 257 | -} | ||
| 258 | - | ||
| 259 | -- (void)xmppDidDisconnect:(NSError *)error | ||
| 260 | -{ | ||
| 261 | - NSLog(@"xmppDidDisconnect:%@",error.localizedDescription); | ||
| 262 | - [self reloadMessage:[NSString stringWithFormat:@"xmppDidDisconnect:%@",error.localizedDescription]]; | ||
| 263 | - // [self.manager reconnection]; | ||
| 264 | -} | ||
| 265 | - | ||
| 266 | -- (void)connectChatRoomFailed:(NSError *)error | ||
| 267 | -{ | ||
| 268 | - NSLog(@"connectChatRoomFailed:%@",error); | ||
| 269 | - [self reloadMessage:[NSString stringWithFormat:@"connectChatRoomFailed:%@",error]]; | ||
| 270 | -} | ||
| 271 | - | ||
| 272 | -- (void)getAccessPermissionsFailed:(NSError *)error | ||
| 273 | -{ | ||
| 274 | - NSLog(@"getAccessPermissionsFailed:%@",error); | ||
| 275 | - [self reloadMessage:[NSString stringWithFormat:@"getAccessPermissionsFailed:%@",error]]; | ||
| 276 | -} | ||
| 277 | -- (void)didJoinRoom:(NSString *)roomName | ||
| 278 | -{ | ||
| 279 | - NSLog(@"didJoinRoom:%@",roomName); | ||
| 280 | - [self reloadMessage:[NSString stringWithFormat:@"didJoinRoom:%@",roomName]]; | ||
| 281 | -} | ||
| 282 | -- (void)didLeaveRoom:(NSString *)roomName | ||
| 283 | -{ | ||
| 284 | - NSLog(@"didLeaveRoom:%@",roomName); | ||
| 285 | - [self reloadMessage:[NSString stringWithFormat:@"didLeaveRoom:%@",roomName]]; | ||
| 286 | -} | ||
| 287 | - | ||
| 288 | -- (void)receivedMessage:(NSString *)msg fromUser:(NSString *)userName | ||
| 289 | -{ | ||
| 290 | - NSLog(@"userName = %@, msg = %@",userName,msg); | ||
| 291 | - [self reloadMessage:[NSString stringWithFormat:@"userName = %@\nmsg = \n%@",userName,msg]]; | ||
| 292 | -} | ||
| 293 | - | ||
| 294 | -- (void)sendMessageFailed:(NSError *)error | ||
| 295 | -{ | ||
| 296 | - NSLog(@"sendMessageFailed:%@",error); | ||
| 297 | - [self reloadMessage:[NSString stringWithFormat:@"sendMessageFailed:%@",error]]; | ||
| 298 | -} | ||
| 299 | - | ||
| 300 | -- (void)nicknameConflict:(NSString *)nickname | ||
| 301 | -{ | ||
| 302 | - NSLog(@"nicknameConflict:%@",nickname); | ||
| 303 | - self.nickStr = nickname; | ||
| 304 | - [self reloadMessage:[NSString stringWithFormat:@"nicknameConflict:%@",nickname]]; | ||
| 305 | -} | ||
| 306 | - | ||
| 307 | -- (void)reloadMessage:(NSString *)msg | ||
| 308 | -{ | ||
| 309 | - [self.mutableStr appendString:[NSString stringWithFormat:@"%@\n",msg]]; | ||
| 310 | - self.textView.text = self.mutableStr; | ||
| 311 | - [self.textView scrollRangeToVisible:NSMakeRange(self.textView.text.length, 1)]; | ||
| 312 | - | ||
| 313 | -// [self.textView sc] | ||
| 314 | -} | ||
| 315 | - | ||
| 316 | - | ||
| 317 | -- (void)didReceiveMemoryWarning { | ||
| 318 | - [super didReceiveMemoryWarning]; | ||
| 319 | - // Dispose of any resources that can be recreated. | ||
| 320 | -} | ||
| 321 | - | ||
| 322 | - | ||
| 323 | -@end |
CNLiveXMPPManagerDemo/CNLiveXMPPManagerDemo/main.m deleted
100644 → 0
| 1 | -// | ||
| 2 | -// main.m | ||
| 3 | -// CNLiveXMPPManagerDemo | ||
| 4 | -// | ||
| 5 | -// Created by 雷浩杰 on 16/9/28. | ||
| 6 | -// Copyright © 2016年 雷浩杰. All rights reserved. | ||
| 7 | -// | ||
| 8 | - | ||
| 9 | -#import <UIKit/UIKit.h> | ||
| 10 | -#import "AppDelegate.h" | ||
| 11 | - | ||
| 12 | -int main(int argc, char * argv[]) { | ||
| 13 | - @autoreleasepool { | ||
| 14 | - return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); | ||
| 15 | - } | ||
| 16 | -} |
CNLiveXMPPManagerDemo/CNLiveXMPPSDK.framework/CNLiveXMPPSDK deleted
100755 → 0
No preview for this file type
CNLiveXMPPManagerDemo/CNLiveXMPPSDK.framework/Headers/CNLiveXMPPManager.h deleted
100644 → 0
| 1 | -// | ||
| 2 | -// XMPPManager.h | ||
| 3 | -// XMPP | ||
| 4 | -// | ||
| 5 | -// Created by CNLive on 13-5-16. | ||
| 6 | -// Copyright (c) 2013年 CNLive. All rights reserved. | ||
| 7 | -// | ||
| 8 | - | ||
| 9 | -#import <Foundation/Foundation.h> | ||
| 10 | - | ||
| 11 | -@protocol XMPPManagerDelegate <NSObject> | ||
| 12 | - | ||
| 13 | -@optional | ||
| 14 | - | ||
| 15 | -- (void)getAccessPermissionsFailed:(NSError *)error; // 鉴权失败回调 | ||
| 16 | - | ||
| 17 | -- (void)connectChatRoomFailed:(NSError *)error; // 加入聊天室失败 | ||
| 18 | - | ||
| 19 | -- (void)connectXmppSuccess; // 连接xmpp成功 | ||
| 20 | - | ||
| 21 | -- (void)xmppDidDisconnect:(NSError *)error; // xmpp主动或者被动断开连接 | ||
| 22 | - | ||
| 23 | -- (void)didJoinRoom:(NSString *)roomName; // 已经加入聊天室 | ||
| 24 | - | ||
| 25 | -- (void)didLeaveRoom:(NSString *)roomName; // 已经离开聊天室 | ||
| 26 | - | ||
| 27 | -- (void)receivedMessage:(NSString *)msg fromUser:(NSString *)userName; // 从聊天室收到的消息 | ||
| 28 | - | ||
| 29 | -- (void)sendMessageFailed:(NSError *)error; // 发送消息失败 | ||
| 30 | - | ||
| 31 | -- (void)nicknameConflict:(NSString *)nickname; // 昵称冲突 | ||
| 32 | - | ||
| 33 | -@end | ||
| 34 | - | ||
| 35 | -@interface CNLiveXMPPManager : NSObject | ||
| 36 | - | ||
| 37 | -/* | ||
| 38 | - * 获取SDK版本号 | ||
| 39 | - */ | ||
| 40 | -+ (NSString *)getVersion; | ||
| 41 | - | ||
| 42 | -// 是否接收历史消息 | ||
| 43 | -@property (nonatomic, assign) BOOL receiveHistory; | ||
| 44 | - | ||
| 45 | -// 代理 | ||
| 46 | -@property (nonatomic, weak) id<XMPPManagerDelegate> delegate; | ||
| 47 | - | ||
| 48 | -// 初始化方法 | ||
| 49 | -/* | ||
| 50 | - 如果autoReconnect为YES,- (void)reconnection 方法失效,XMPP会自动断线重连 | ||
| 51 | - */ | ||
| 52 | -- (instancetype)initWithChatRoomId:(NSString *)roomId appId:(NSString *)appId app_key:(NSString *)appKey autoReconnect:(BOOL)reconnect; | ||
| 53 | - | ||
| 54 | -// 使用某一昵称加入聊天室 | ||
| 55 | -- (void)joinRoomWithNickName:(NSString *)nick; | ||
| 56 | - | ||
| 57 | -// 发送消息 | ||
| 58 | -- (void)sendMessage:(NSString *)message; | ||
| 59 | - | ||
| 60 | -// 更换昵称 | ||
| 61 | -- (void)changeNickname:(NSString*)nickname; | ||
| 62 | - | ||
| 63 | -// 重新连接xmpp | ||
| 64 | -- (void)reconnection; | ||
| 65 | - | ||
| 66 | -// 离开聊天室 | ||
| 67 | -- (void)leaveRoom; | ||
| 68 | - | ||
| 69 | -// 断开xmpp链接 | ||
| 70 | -- (void)disconnect; | ||
| 71 | -@end |
CNLiveXMPPManagerDemo/CNLiveXMPPSDK.framework/Info.plist deleted
100644 → 0
No preview for this file type
CNLiveXMPPManagerDemo/CocoaAsyncSocket.framework/CocoaAsyncSocket deleted
100755 → 0
No preview for this file type
CNLiveXMPPManagerDemo/CocoaAsyncSocket.framework/Headers/CocoaAsyncSocket-umbrella.h deleted
100644 → 0
CNLiveXMPPManagerDemo/CocoaAsyncSocket.framework/Headers/GCDAsyncSocket.h deleted
100644 → 0
| 1 | -// | ||
| 2 | -// GCDAsyncSocket.h | ||
| 3 | -// | ||
| 4 | -// This class is in the public domain. | ||
| 5 | -// Originally created by Robbie Hanson in Q3 2010. | ||
| 6 | -// Updated and maintained by Deusty LLC and the Apple development community. | ||
| 7 | -// | ||
| 8 | -// https://github.com/robbiehanson/CocoaAsyncSocket | ||
| 9 | -// | ||
| 10 | - | ||
| 11 | -#import <Foundation/Foundation.h> | ||
| 12 | -#import <Security/Security.h> | ||
| 13 | -#import <Security/SecureTransport.h> | ||
| 14 | -#import <dispatch/dispatch.h> | ||
| 15 | -#import <Availability.h> | ||
| 16 | - | ||
| 17 | -#include <sys/socket.h> // AF_INET, AF_INET6 | ||
| 18 | - | ||
| 19 | -@class GCDAsyncReadPacket; | ||
| 20 | -@class GCDAsyncWritePacket; | ||
| 21 | -@class GCDAsyncSocketPreBuffer; | ||
| 22 | -@protocol GCDAsyncSocketDelegate; | ||
| 23 | - | ||
| 24 | -NS_ASSUME_NONNULL_BEGIN | ||
| 25 | - | ||
| 26 | -extern NSString *const GCDAsyncSocketException; | ||
| 27 | -extern NSString *const GCDAsyncSocketErrorDomain; | ||
| 28 | - | ||
| 29 | -extern NSString *const GCDAsyncSocketQueueName; | ||
| 30 | -extern NSString *const GCDAsyncSocketThreadName; | ||
| 31 | - | ||
| 32 | -extern NSString *const GCDAsyncSocketManuallyEvaluateTrust; | ||
| 33 | -#if TARGET_OS_IPHONE | ||
| 34 | -extern NSString *const GCDAsyncSocketUseCFStreamForTLS; | ||
| 35 | -#endif | ||
| 36 | -#define GCDAsyncSocketSSLPeerName (NSString *)kCFStreamSSLPeerName | ||
| 37 | -#define GCDAsyncSocketSSLCertificates (NSString *)kCFStreamSSLCertificates | ||
| 38 | -#define GCDAsyncSocketSSLIsServer (NSString *)kCFStreamSSLIsServer | ||
| 39 | -extern NSString *const GCDAsyncSocketSSLPeerID; | ||
| 40 | -extern NSString *const GCDAsyncSocketSSLProtocolVersionMin; | ||
| 41 | -extern NSString *const GCDAsyncSocketSSLProtocolVersionMax; | ||
| 42 | -extern NSString *const GCDAsyncSocketSSLSessionOptionFalseStart; | ||
| 43 | -extern NSString *const GCDAsyncSocketSSLSessionOptionSendOneByteRecord; | ||
| 44 | -extern NSString *const GCDAsyncSocketSSLCipherSuites; | ||
| 45 | -#if !TARGET_OS_IPHONE | ||
| 46 | -extern NSString *const GCDAsyncSocketSSLDiffieHellmanParameters; | ||
| 47 | -#endif | ||
| 48 | - | ||
| 49 | -#define GCDAsyncSocketLoggingContext 65535 | ||
| 50 | - | ||
| 51 | - | ||
| 52 | -typedef NS_ENUM(NSInteger, GCDAsyncSocketError) { | ||
| 53 | - GCDAsyncSocketNoError = 0, // Never used | ||
| 54 | - GCDAsyncSocketBadConfigError, // Invalid configuration | ||
| 55 | - GCDAsyncSocketBadParamError, // Invalid parameter was passed | ||
| 56 | - GCDAsyncSocketConnectTimeoutError, // A connect operation timed out | ||
| 57 | - GCDAsyncSocketReadTimeoutError, // A read operation timed out | ||
| 58 | - GCDAsyncSocketWriteTimeoutError, // A write operation timed out | ||
| 59 | - GCDAsyncSocketReadMaxedOutError, // Reached set maxLength without completing | ||
| 60 | - GCDAsyncSocketClosedError, // The remote peer closed the connection | ||
| 61 | - GCDAsyncSocketOtherError, // Description provided in userInfo | ||
| 62 | -}; | ||
| 63 | - | ||
| 64 | -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
| 65 | -#pragma mark - | ||
| 66 | -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
| 67 | - | ||
| 68 | - | ||
| 69 | -@interface GCDAsyncSocket : NSObject | ||
| 70 | - | ||
| 71 | -/** | ||
| 72 | - * GCDAsyncSocket uses the standard delegate paradigm, | ||
| 73 | - * but executes all delegate callbacks on a given delegate dispatch queue. | ||
| 74 | - * This allows for maximum concurrency, while at the same time providing easy thread safety. | ||
| 75 | - * | ||
| 76 | - * You MUST set a delegate AND delegate dispatch queue before attempting to | ||
| 77 | - * use the socket, or you will get an error. | ||
| 78 | - * | ||
| 79 | - * The socket queue is optional. | ||
| 80 | - * If you pass NULL, GCDAsyncSocket will automatically create it's own socket queue. | ||
| 81 | - * If you choose to provide a socket queue, the socket queue must not be a concurrent queue. | ||
| 82 | - * If you choose to provide a socket queue, and the socket queue has a configured target queue, | ||
| 83 | - * then please see the discussion for the method markSocketQueueTargetQueue. | ||
| 84 | - * | ||
| 85 | - * The delegate queue and socket queue can optionally be the same. | ||
| 86 | -**/ | ||
| 87 | -- (instancetype)init; | ||
| 88 | -- (instancetype)initWithSocketQueue:(nullable dispatch_queue_t)sq; | ||
| 89 | -- (instancetype)initWithDelegate:(nullable id<GCDAsyncSocketDelegate>)aDelegate delegateQueue:(nullable dispatch_queue_t)dq; | ||
| 90 | -- (instancetype)initWithDelegate:(nullable id<GCDAsyncSocketDelegate>)aDelegate delegateQueue:(nullable dispatch_queue_t)dq socketQueue:(nullable dispatch_queue_t)sq; | ||
| 91 | - | ||
| 92 | -#pragma mark Configuration | ||
| 93 | - | ||
| 94 | -@property (atomic, weak, readwrite, nullable) id<GCDAsyncSocketDelegate> delegate; | ||
| 95 | -#if OS_OBJECT_USE_OBJC | ||
| 96 | -@property (atomic, strong, readwrite, nullable) dispatch_queue_t delegateQueue; | ||
| 97 | -#else | ||
| 98 | -@property (atomic, assign, readwrite, nullable) dispatch_queue_t delegateQueue; | ||
| 99 | -#endif | ||
| 100 | - | ||
| 101 | -- (void)getDelegate:(id<GCDAsyncSocketDelegate> __nullable * __nullable)delegatePtr delegateQueue:(dispatch_queue_t __nullable * __nullable)delegateQueuePtr; | ||
| 102 | -- (void)setDelegate:(nullable id<GCDAsyncSocketDelegate>)delegate delegateQueue:(nullable dispatch_queue_t)delegateQueue; | ||
| 103 | - | ||
| 104 | -/** | ||
| 105 | - * If you are setting the delegate to nil within the delegate's dealloc method, | ||
| 106 | - * you may need to use the synchronous versions below. | ||
| 107 | -**/ | ||
| 108 | -- (void)synchronouslySetDelegate:(nullable id<GCDAsyncSocketDelegate>)delegate; | ||
| 109 | -- (void)synchronouslySetDelegateQueue:(nullable dispatch_queue_t)delegateQueue; | ||
| 110 | -- (void)synchronouslySetDelegate:(nullable id<GCDAsyncSocketDelegate>)delegate delegateQueue:(nullable dispatch_queue_t)delegateQueue; | ||
| 111 | - | ||
| 112 | -/** | ||
| 113 | - * By default, both IPv4 and IPv6 are enabled. | ||
| 114 | - * | ||
| 115 | - * For accepting incoming connections, this means GCDAsyncSocket automatically supports both protocols, | ||
| 116 | - * and can simulataneously accept incoming connections on either protocol. | ||
| 117 | - * | ||
| 118 | - * For outgoing connections, this means GCDAsyncSocket can connect to remote hosts running either protocol. | ||
| 119 | - * If a DNS lookup returns only IPv4 results, GCDAsyncSocket will automatically use IPv4. | ||
| 120 | - * If a DNS lookup returns only IPv6 results, GCDAsyncSocket will automatically use IPv6. | ||
| 121 | - * If a DNS lookup returns both IPv4 and IPv6 results, the preferred protocol will be chosen. | ||
| 122 | - * By default, the preferred protocol is IPv4, but may be configured as desired. | ||
| 123 | -**/ | ||
| 124 | - | ||
| 125 | -@property (atomic, assign, readwrite, getter=isIPv4Enabled) BOOL IPv4Enabled; | ||
| 126 | -@property (atomic, assign, readwrite, getter=isIPv6Enabled) BOOL IPv6Enabled; | ||
| 127 | - | ||
| 128 | -@property (atomic, assign, readwrite, getter=isIPv4PreferredOverIPv6) BOOL IPv4PreferredOverIPv6; | ||
| 129 | - | ||
| 130 | -/** | ||
| 131 | - * When connecting to both IPv4 and IPv6 using Happy Eyeballs (RFC 6555) https://tools.ietf.org/html/rfc6555 | ||
| 132 | - * this is the delay between connecting to the preferred protocol and the fallback protocol. | ||
| 133 | - * | ||
| 134 | - * Defaults to 300ms. | ||
| 135 | -**/ | ||
| 136 | -@property (atomic, assign, readwrite) NSTimeInterval alternateAddressDelay; | ||
| 137 | - | ||
| 138 | -/** | ||
| 139 | - * User data allows you to associate arbitrary information with the socket. | ||
| 140 | - * This data is not used internally by socket in any way. | ||
| 141 | -**/ | ||
| 142 | -@property (atomic, strong, readwrite, nullable) id userData; | ||
| 143 | - | ||
| 144 | -#pragma mark Accepting | ||
| 145 | - | ||
| 146 | -/** | ||
| 147 | - * Tells the socket to begin listening and accepting connections on the given port. | ||
| 148 | - * When a connection is accepted, a new instance of GCDAsyncSocket will be spawned to handle it, | ||
| 149 | - * and the socket:didAcceptNewSocket: delegate method will be invoked. | ||
| 150 | - * | ||
| 151 | - * The socket will listen on all available interfaces (e.g. wifi, ethernet, etc) | ||
| 152 | -**/ | ||
| 153 | -- (BOOL)acceptOnPort:(uint16_t)port error:(NSError **)errPtr; | ||
| 154 | - | ||
| 155 | -/** | ||
| 156 | - * This method is the same as acceptOnPort:error: with the | ||
| 157 | - * additional option of specifying which interface to listen on. | ||
| 158 | - * | ||
| 159 | - * For example, you could specify that the socket should only accept connections over ethernet, | ||
| 160 | - * and not other interfaces such as wifi. | ||
| 161 | - * | ||
| 162 | - * The interface may be specified by name (e.g. "en1" or "lo0") or by IP address (e.g. "192.168.4.34"). | ||
| 163 | - * You may also use the special strings "localhost" or "loopback" to specify that | ||
| 164 | - * the socket only accept connections from the local machine. | ||
| 165 | - * | ||
| 166 | - * You can see the list of interfaces via the command line utility "ifconfig", | ||
| 167 | - * or programmatically via the getifaddrs() function. | ||
| 168 | - * | ||
| 169 | - * To accept connections on any interface pass nil, or simply use the acceptOnPort:error: method. | ||
| 170 | -**/ | ||
| 171 | -- (BOOL)acceptOnInterface:(nullable NSString *)interface port:(uint16_t)port error:(NSError **)errPtr; | ||
| 172 | - | ||
| 173 | -/** | ||
| 174 | - * Tells the socket to begin listening and accepting connections on the unix domain at the given url. | ||
| 175 | - * When a connection is accepted, a new instance of GCDAsyncSocket will be spawned to handle it, | ||
| 176 | - * and the socket:didAcceptNewSocket: delegate method will be invoked. | ||
| 177 | - * | ||
| 178 | - * The socket will listen on all available interfaces (e.g. wifi, ethernet, etc) | ||
| 179 | - **/ | ||
| 180 | -- (BOOL)acceptOnUrl:(NSURL *)url error:(NSError **)errPtr; | ||
| 181 | - | ||
| 182 | -#pragma mark Connecting | ||
| 183 | - | ||
| 184 | -/** | ||
| 185 | - * Connects to the given host and port. | ||
| 186 | - * | ||
| 187 | - * This method invokes connectToHost:onPort:viaInterface:withTimeout:error: | ||
| 188 | - * and uses the default interface, and no timeout. | ||
| 189 | -**/ | ||
| 190 | -- (BOOL)connectToHost:(NSString *)host onPort:(uint16_t)port error:(NSError **)errPtr; | ||
| 191 | - | ||
| 192 | -/** | ||
| 193 | - * Connects to the given host and port with an optional timeout. | ||
| 194 | - * | ||
| 195 | - * This method invokes connectToHost:onPort:viaInterface:withTimeout:error: and uses the default interface. | ||
| 196 | -**/ | ||
| 197 | -- (BOOL)connectToHost:(NSString *)host | ||
| 198 | - onPort:(uint16_t)port | ||
| 199 | - withTimeout:(NSTimeInterval)timeout | ||
| 200 | - error:(NSError **)errPtr; | ||
| 201 | - | ||
| 202 | -/** | ||
| 203 | - * Connects to the given host & port, via the optional interface, with an optional timeout. | ||
| 204 | - * | ||
| 205 | - * The host may be a domain name (e.g. "deusty.com") or an IP address string (e.g. "192.168.0.2"). | ||
| 206 | - * The host may also be the special strings "localhost" or "loopback" to specify connecting | ||
| 207 | - * to a service on the local machine. | ||
| 208 | - * | ||
| 209 | - * The interface may be a name (e.g. "en1" or "lo0") or the corresponding IP address (e.g. "192.168.4.35"). | ||
| 210 | - * The interface may also be used to specify the local port (see below). | ||
| 211 | - * | ||
| 212 | - * To not time out use a negative time interval. | ||
| 213 | - * | ||
| 214 | - * This method will return NO if an error is detected, and set the error pointer (if one was given). | ||
| 215 | - * Possible errors would be a nil host, invalid interface, or socket is already connected. | ||
| 216 | - * | ||
| 217 | - * If no errors are detected, this method will start a background connect operation and immediately return YES. | ||
| 218 | - * The delegate callbacks are used to notify you when the socket connects, or if the host was unreachable. | ||
| 219 | - * | ||
| 220 | - * Since this class supports queued reads and writes, you can immediately start reading and/or writing. | ||
| 221 | - * All read/write operations will be queued, and upon socket connection, | ||
| 222 | - * the operations will be dequeued and processed in order. | ||
| 223 | - * | ||
| 224 | - * The interface may optionally contain a port number at the end of the string, separated by a colon. | ||
| 225 | - * This allows you to specify the local port that should be used for the outgoing connection. (read paragraph to end) | ||
| 226 | - * To specify both interface and local port: "en1:8082" or "192.168.4.35:2424". | ||
| 227 | - * To specify only local port: ":8082". | ||
| 228 | - * Please note this is an advanced feature, and is somewhat hidden on purpose. | ||
| 229 | - * You should understand that 99.999% of the time you should NOT specify the local port for an outgoing connection. | ||
| 230 | - * If you think you need to, there is a very good chance you have a fundamental misunderstanding somewhere. | ||
| 231 | - * Local ports do NOT need to match remote ports. In fact, they almost never do. | ||
| 232 | - * This feature is here for networking professionals using very advanced techniques. | ||
| 233 | -**/ | ||
| 234 | -- (BOOL)connectToHost:(NSString *)host | ||
| 235 | - onPort:(uint16_t)port | ||
| 236 | - viaInterface:(nullable NSString *)interface | ||
| 237 | - withTimeout:(NSTimeInterval)timeout | ||
| 238 | - error:(NSError **)errPtr; | ||
| 239 | - | ||
| 240 | -/** | ||
| 241 | - * Connects to the given address, specified as a sockaddr structure wrapped in a NSData object. | ||
| 242 | - * For example, a NSData object returned from NSNetService's addresses method. | ||
| 243 | - * | ||
| 244 | - * If you have an existing struct sockaddr you can convert it to a NSData object like so: | ||
| 245 | - * struct sockaddr sa -> NSData *dsa = [NSData dataWithBytes:&remoteAddr length:remoteAddr.sa_len]; | ||
| 246 | - * struct sockaddr *sa -> NSData *dsa = [NSData dataWithBytes:remoteAddr length:remoteAddr->sa_len]; | ||
| 247 | - * | ||
| 248 | - * This method invokes connectToAdd | ||
| 249 | -**/ | ||
| 250 | -- (BOOL)connectToAddress:(NSData *)remoteAddr error:(NSError **)errPtr; | ||
| 251 | - | ||
| 252 | -/** | ||
| 253 | - * This method is the same as connectToAddress:error: with an additional timeout option. | ||
| 254 | - * To not time out use a negative time interval, or simply use the connectToAddress:error: method. | ||
| 255 | -**/ | ||
| 256 | -- (BOOL)connectToAddress:(NSData *)remoteAddr withTimeout:(NSTimeInterval)timeout error:(NSError **)errPtr; | ||
| 257 | - | ||
| 258 | -/** | ||
| 259 | - * Connects to the given address, using the specified interface and timeout. | ||
| 260 | - * | ||
| 261 | - * The address is specified as a sockaddr structure wrapped in a NSData object. | ||
| 262 | - * For example, a NSData object returned from NSNetService's addresses method. | ||
| 263 | - * | ||
| 264 | - * If you have an existing struct sockaddr you can convert it to a NSData object like so: | ||
| 265 | - * struct sockaddr sa -> NSData *dsa = [NSData dataWithBytes:&remoteAddr length:remoteAddr.sa_len]; | ||
| 266 | - * struct sockaddr *sa -> NSData *dsa = [NSData dataWithBytes:remoteAddr length:remoteAddr->sa_len]; | ||
| 267 | - * | ||
| 268 | - * The interface may be a name (e.g. "en1" or "lo0") or the corresponding IP address (e.g. "192.168.4.35"). | ||
| 269 | - * The interface may also be used to specify the local port (see below). | ||
| 270 | - * | ||
| 271 | - * The timeout is optional. To not time out use a negative time interval. | ||
| 272 | - * | ||
| 273 | - * This method will return NO if an error is detected, and set the error pointer (if one was given). | ||
| 274 | - * Possible errors would be a nil host, invalid interface, or socket is already connected. | ||
| 275 | - * | ||
| 276 | - * If no errors are detected, this method will start a background connect operation and immediately return YES. | ||
| 277 | - * The delegate callbacks are used to notify you when the socket connects, or if the host was unreachable. | ||
| 278 | - * | ||
| 279 | - * Since this class supports queued reads and writes, you can immediately start reading and/or writing. | ||
| 280 | - * All read/write operations will be queued, and upon socket connection, | ||
| 281 | - * the operations will be dequeued and processed in order. | ||
| 282 | - * | ||
| 283 | - * The interface may optionally contain a port number at the end of the string, separated by a colon. | ||
| 284 | - * This allows you to specify the local port that should be used for the outgoing connection. (read paragraph to end) | ||
| 285 | - * To specify both interface and local port: "en1:8082" or "192.168.4.35:2424". | ||
| 286 | - * To specify only local port: ":8082". | ||
| 287 | - * Please note this is an advanced feature, and is somewhat hidden on purpose. | ||
| 288 | - * You should understand that 99.999% of the time you should NOT specify the local port for an outgoing connection. | ||
| 289 | - * If you think you need to, there is a very good chance you have a fundamental misunderstanding somewhere. | ||
| 290 | - * Local ports do NOT need to match remote ports. In fact, they almost never do. | ||
| 291 | - * This feature is here for networking professionals using very advanced techniques. | ||
| 292 | -**/ | ||
| 293 | -- (BOOL)connectToAddress:(NSData *)remoteAddr | ||
| 294 | - viaInterface:(nullable NSString *)interface | ||
| 295 | - withTimeout:(NSTimeInterval)timeout | ||
| 296 | - error:(NSError **)errPtr; | ||
| 297 | -/** | ||
| 298 | - * Connects to the unix domain socket at the given url, using the specified timeout. | ||
| 299 | - */ | ||
| 300 | -- (BOOL)connectToUrl:(NSURL *)url withTimeout:(NSTimeInterval)timeout error:(NSError **)errPtr; | ||
| 301 | - | ||
| 302 | -#pragma mark Disconnecting | ||
| 303 | - | ||
| 304 | -/** | ||
| 305 | - * Disconnects immediately (synchronously). Any pending reads or writes are dropped. | ||
| 306 | - * | ||
| 307 | - * If the socket is not already disconnected, an invocation to the socketDidDisconnect:withError: delegate method | ||
| 308 | - * will be queued onto the delegateQueue asynchronously (behind any previously queued delegate methods). | ||
| 309 | - * In other words, the disconnected delegate method will be invoked sometime shortly after this method returns. | ||
| 310 | - * | ||
| 311 | - * Please note the recommended way of releasing a GCDAsyncSocket instance (e.g. in a dealloc method) | ||
| 312 | - * [asyncSocket setDelegate:nil]; | ||
| 313 | - * [asyncSocket disconnect]; | ||
| 314 | - * [asyncSocket release]; | ||
| 315 | - * | ||
| 316 | - * If you plan on disconnecting the socket, and then immediately asking it to connect again, | ||
| 317 | - * you'll likely want to do so like this: | ||
| 318 | - * [asyncSocket setDelegate:nil]; | ||
| 319 | - * [asyncSocket disconnect]; | ||
| 320 | - * [asyncSocket setDelegate:self]; | ||
| 321 | - * [asyncSocket connect...]; | ||
| 322 | -**/ | ||
| 323 | -- (void)disconnect; | ||
| 324 | - | ||
| 325 | -/** | ||
| 326 | - * Disconnects after all pending reads have completed. | ||
| 327 | - * After calling this, the read and write methods will do nothing. | ||
| 328 | - * The socket will disconnect even if there are still pending writes. | ||
| 329 | -**/ | ||
| 330 | -- (void)disconnectAfterReading; | ||
| 331 | - | ||
| 332 | -/** | ||
| 333 | - * Disconnects after all pending writes have completed. | ||
| 334 | - * After calling this, the read and write methods will do nothing. | ||
| 335 | - * The socket will disconnect even if there are still pending reads. | ||
| 336 | -**/ | ||
| 337 | -- (void)disconnectAfterWriting; | ||
| 338 | - | ||
| 339 | -/** | ||
| 340 | - * Disconnects after all pending reads and writes have completed. | ||
| 341 | - * After calling this, the read and write methods will do nothing. | ||
| 342 | -**/ | ||
| 343 | -- (void)disconnectAfterReadingAndWriting; | ||
| 344 | - | ||
| 345 | -#pragma mark Diagnostics | ||
| 346 | - | ||
| 347 | -/** | ||
| 348 | - * Returns whether the socket is disconnected or connected. | ||
| 349 | - * | ||
| 350 | - * A disconnected socket may be recycled. | ||
| 351 | - * That is, it can used again for connecting or listening. | ||
| 352 | - * | ||
| 353 | - * If a socket is in the process of connecting, it may be neither disconnected nor connected. | ||
| 354 | -**/ | ||
| 355 | -@property (atomic, readonly) BOOL isDisconnected; | ||
| 356 | -@property (atomic, readonly) BOOL isConnected; | ||
| 357 | - | ||
| 358 | -/** | ||
| 359 | - * Returns the local or remote host and port to which this socket is connected, or nil and 0 if not connected. | ||
| 360 | - * The host will be an IP address. | ||
| 361 | -**/ | ||
| 362 | -@property (atomic, readonly, nullable) NSString *connectedHost; | ||
| 363 | -@property (atomic, readonly) uint16_t connectedPort; | ||
| 364 | -@property (atomic, readonly, nullable) NSURL *connectedUrl; | ||
| 365 | - | ||
| 366 | -@property (atomic, readonly, nullable) NSString *localHost; | ||
| 367 | -@property (atomic, readonly) uint16_t localPort; | ||
| 368 | - | ||
| 369 | -/** | ||
| 370 | - * Returns the local or remote address to which this socket is connected, | ||
| 371 | - * specified as a sockaddr structure wrapped in a NSData object. | ||
| 372 | - * | ||
| 373 | - * @seealso connectedHost | ||
| 374 | - * @seealso connectedPort | ||
| 375 | - * @seealso localHost | ||
| 376 | - * @seealso localPort | ||
| 377 | -**/ | ||
| 378 | -@property (atomic, readonly, nullable) NSData *connectedAddress; | ||
| 379 | -@property (atomic, readonly, nullable) NSData *localAddress; | ||
| 380 | - | ||
| 381 | -/** | ||
| 382 | - * Returns whether the socket is IPv4 or IPv6. | ||
| 383 | - * An accepting socket may be both. | ||
| 384 | -**/ | ||
| 385 | -@property (atomic, readonly) BOOL isIPv4; | ||
| 386 | -@property (atomic, readonly) BOOL isIPv6; | ||
| 387 | - | ||
| 388 | -/** | ||
| 389 | - * Returns whether or not the socket has been secured via SSL/TLS. | ||
| 390 | - * | ||
| 391 | - * See also the startTLS method. | ||
| 392 | -**/ | ||
| 393 | -@property (atomic, readonly) BOOL isSecure; | ||
| 394 | - | ||
| 395 | -#pragma mark Reading | ||
| 396 | - | ||
| 397 | -// The readData and writeData methods won't block (they are asynchronous). | ||
| 398 | -// | ||
| 399 | -// When a read is complete the socket:didReadData:withTag: delegate method is dispatched on the delegateQueue. | ||
| 400 | -// When a write is complete the socket:didWriteDataWithTag: delegate method is dispatched on the delegateQueue. | ||
| 401 | -// | ||
| 402 | -// You may optionally set a timeout for any read/write operation. (To not timeout, use a negative time interval.) | ||
| 403 | -// If a read/write opertion times out, the corresponding "socket:shouldTimeout..." delegate method | ||
| 404 | -// is called to optionally allow you to extend the timeout. | ||
| 405 | -// Upon a timeout, the "socket:didDisconnectWithError:" method is called | ||
| 406 | -// | ||
| 407 | -// The tag is for your convenience. | ||
| 408 | -// You can use it as an array index, step number, state id, pointer, etc. | ||
| 409 | - | ||
| 410 | -/** | ||
| 411 | - * Reads the first available bytes that become available on the socket. | ||
| 412 | - * | ||
| 413 | - * If the timeout value is negative, the read operation will not use a timeout. | ||
| 414 | -**/ | ||
| 415 | -- (void)readDataWithTimeout:(NSTimeInterval)timeout tag:(long)tag; | ||
| 416 | - | ||
| 417 | -/** | ||
| 418 | - * Reads the first available bytes that become available on the socket. | ||
| 419 | - * The bytes will be appended to the given byte buffer starting at the given offset. | ||
| 420 | - * The given buffer will automatically be increased in size if needed. | ||
| 421 | - * | ||
| 422 | - * If the timeout value is negative, the read operation will not use a timeout. | ||
| 423 | - * If the buffer if nil, the socket will create a buffer for you. | ||
| 424 | - * | ||
| 425 | - * If the bufferOffset is greater than the length of the given buffer, | ||
| 426 | - * the method will do nothing, and the delegate will not be called. | ||
| 427 | - * | ||
| 428 | - * If you pass a buffer, you must not alter it in any way while the socket is using it. | ||
| 429 | - * After completion, the data returned in socket:didReadData:withTag: will be a subset of the given buffer. | ||
| 430 | - * That is, it will reference the bytes that were appended to the given buffer via | ||
| 431 | - * the method [NSData dataWithBytesNoCopy:length:freeWhenDone:NO]. | ||
| 432 | -**/ | ||
| 433 | -- (void)readDataWithTimeout:(NSTimeInterval)timeout | ||
| 434 | - buffer:(nullable NSMutableData *)buffer | ||
| 435 | - bufferOffset:(NSUInteger)offset | ||
| 436 | - tag:(long)tag; | ||
| 437 | - | ||
| 438 | -/** | ||
| 439 | - * Reads the first available bytes that become available on the socket. | ||
| 440 | - * The bytes will be appended to the given byte buffer starting at the given offset. | ||
| 441 | - * The given buffer will automatically be increased in size if needed. | ||
| 442 | - * A maximum of length bytes will be read. | ||
| 443 | - * | ||
| 444 | - * If the timeout value is negative, the read operation will not use a timeout. | ||
| 445 | - * If the buffer if nil, a buffer will automatically be created for you. | ||
| 446 | - * If maxLength is zero, no length restriction is enforced. | ||
| 447 | - * | ||
| 448 | - * If the bufferOffset is greater than the length of the given buffer, | ||
| 449 | - * the method will do nothing, and the delegate will not be called. | ||
| 450 | - * | ||
| 451 | - * If you pass a buffer, you must not alter it in any way while the socket is using it. | ||
| 452 | - * After completion, the data returned in socket:didReadData:withTag: will be a subset of the given buffer. | ||
| 453 | - * That is, it will reference the bytes that were appended to the given buffer via | ||
| 454 | - * the method [NSData dataWithBytesNoCopy:length:freeWhenDone:NO]. | ||
| 455 | -**/ | ||
| 456 | -- (void)readDataWithTimeout:(NSTimeInterval)timeout | ||
| 457 | - buffer:(nullable NSMutableData *)buffer | ||
| 458 | - bufferOffset:(NSUInteger)offset | ||
| 459 | - maxLength:(NSUInteger)length | ||
| 460 | - tag:(long)tag; | ||
| 461 | - | ||
| 462 | -/** | ||
| 463 | - * Reads the given number of bytes. | ||
| 464 | - * | ||
| 465 | - * If the timeout value is negative, the read operation will not use a timeout. | ||
| 466 | - * | ||
| 467 | - * If the length is 0, this method does nothing and the delegate is not called. | ||
| 468 | -**/ | ||
| 469 | -- (void)readDataToLength:(NSUInteger)length withTimeout:(NSTimeInterval)timeout tag:(long)tag; | ||
| 470 | - | ||
| 471 | -/** | ||
| 472 | - * Reads the given number of bytes. | ||
| 473 | - * The bytes will be appended to the given byte buffer starting at the given offset. | ||
| 474 | - * The given buffer will automatically be increased in size if needed. | ||
| 475 | - * | ||
| 476 | - * If the timeout value is negative, the read operation will not use a timeout. | ||
| 477 | - * If the buffer if nil, a buffer will automatically be created for you. | ||
| 478 | - * | ||
| 479 | - * If the length is 0, this method does nothing and the delegate is not called. | ||
| 480 | - * If the bufferOffset is greater than the length of the given buffer, | ||
| 481 | - * the method will do nothing, and the delegate will not be called. | ||
| 482 | - * | ||
| 483 | - * If you pass a buffer, you must not alter it in any way while AsyncSocket is using it. | ||
| 484 | - * After completion, the data returned in socket:didReadData:withTag: will be a subset of the given buffer. | ||
| 485 | - * That is, it will reference the bytes that were appended to the given buffer via | ||
| 486 | - * the method [NSData dataWithBytesNoCopy:length:freeWhenDone:NO]. | ||
| 487 | -**/ | ||
| 488 | -- (void)readDataToLength:(NSUInteger)length | ||
| 489 | - withTimeout:(NSTimeInterval)timeout | ||
| 490 | - buffer:(nullable NSMutableData *)buffer | ||
| 491 | - bufferOffset:(NSUInteger)offset | ||
| 492 | - tag:(long)tag; | ||
| 493 | - | ||
| 494 | -/** | ||
| 495 | - * Reads bytes until (and including) the passed "data" parameter, which acts as a separator. | ||
| 496 | - * | ||
| 497 | - * If the timeout value is negative, the read operation will not use a timeout. | ||
| 498 | - * | ||
| 499 | - * If you pass nil or zero-length data as the "data" parameter, | ||
| 500 | - * the method will do nothing (except maybe print a warning), and the delegate will not be called. | ||
| 501 | - * | ||
| 502 | - * To read a line from the socket, use the line separator (e.g. CRLF for HTTP, see below) as the "data" parameter. | ||
| 503 | - * If you're developing your own custom protocol, be sure your separator can not occur naturally as | ||
| 504 | - * part of the data between separators. | ||
| 505 | - * For example, imagine you want to send several small documents over a socket. | ||
| 506 | - * Using CRLF as a separator is likely unwise, as a CRLF could easily exist within the documents. | ||
| 507 | - * In this particular example, it would be better to use a protocol similar to HTTP with | ||
| 508 | - * a header that includes the length of the document. | ||
| 509 | - * Also be careful that your separator cannot occur naturally as part of the encoding for a character. | ||
| 510 | - * | ||
| 511 | - * The given data (separator) parameter should be immutable. | ||
| 512 | - * For performance reasons, the socket will retain it, not copy it. | ||
| 513 | - * So if it is immutable, don't modify it while the socket is using it. | ||
| 514 | -**/ | ||
| 515 | -- (void)readDataToData:(NSData *)data withTimeout:(NSTimeInterval)timeout tag:(long)tag; | ||
| 516 | - | ||
| 517 | -/** | ||
| 518 | - * Reads bytes until (and including) the passed "data" parameter, which acts as a separator. | ||
| 519 | - * The bytes will be appended to the given byte buffer starting at the given offset. | ||
| 520 | - * The given buffer will automatically be increased in size if needed. | ||
| 521 | - * | ||
| 522 | - * If the timeout value is negative, the read operation will not use a timeout. | ||
| 523 | - * If the buffer if nil, a buffer will automatically be created for you. | ||
| 524 | - * | ||
| 525 | - * If the bufferOffset is greater than the length of the given buffer, | ||
| 526 | - * the method will do nothing (except maybe print a warning), and the delegate will not be called. | ||
| 527 | - * | ||
| 528 | - * If you pass a buffer, you must not alter it in any way while the socket is using it. | ||
| 529 | - * After completion, the data returned in socket:didReadData:withTag: will be a subset of the given buffer. | ||
| 530 | - * That is, it will reference the bytes that were appended to the given buffer via | ||
| 531 | - * the method [NSData dataWithBytesNoCopy:length:freeWhenDone:NO]. | ||
| 532 | - * | ||
| 533 | - * To read a line from the socket, use the line separator (e.g. CRLF for HTTP, see below) as the "data" parameter. | ||
| 534 | - * If you're developing your own custom protocol, be sure your separator can not occur naturally as | ||
| 535 | - * part of the data between separators. | ||
| 536 | - * For example, imagine you want to send several small documents over a socket. | ||
| 537 | - * Using CRLF as a separator is likely unwise, as a CRLF could easily exist within the documents. | ||
| 538 | - * In this particular example, it would be better to use a protocol similar to HTTP with | ||
| 539 | - * a header that includes the length of the document. | ||
| 540 | - * Also be careful that your separator cannot occur naturally as part of the encoding for a character. | ||
| 541 | - * | ||
| 542 | - * The given data (separator) parameter should be immutable. | ||
| 543 | - * For performance reasons, the socket will retain it, not copy it. | ||
| 544 | - * So if it is immutable, don't modify it while the socket is using it. | ||
| 545 | -**/ | ||
| 546 | -- (void)readDataToData:(NSData *)data | ||
| 547 | - withTimeout:(NSTimeInterval)timeout | ||
| 548 | - buffer:(nullable NSMutableData *)buffer | ||
| 549 | - bufferOffset:(NSUInteger)offset | ||
| 550 | - tag:(long)tag; | ||
| 551 | - | ||
| 552 | -/** | ||
| 553 | - * Reads bytes until (and including) the passed "data" parameter, which acts as a separator. | ||
| 554 | - * | ||
| 555 | - * If the timeout value is negative, the read operation will not use a timeout. | ||
| 556 | - * | ||
| 557 | - * If maxLength is zero, no length restriction is enforced. | ||
| 558 | - * Otherwise if maxLength bytes are read without completing the read, | ||
| 559 | - * it is treated similarly to a timeout - the socket is closed with a GCDAsyncSocketReadMaxedOutError. | ||
| 560 | - * The read will complete successfully if exactly maxLength bytes are read and the given data is found at the end. | ||
| 561 | - * | ||
| 562 | - * If you pass nil or zero-length data as the "data" parameter, | ||
| 563 | - * the method will do nothing (except maybe print a warning), and the delegate will not be called. | ||
| 564 | - * If you pass a maxLength parameter that is less than the length of the data parameter, | ||
| 565 | - * the method will do nothing (except maybe print a warning), and the delegate will not be called. | ||
| 566 | - * | ||
| 567 | - * To read a line from the socket, use the line separator (e.g. CRLF for HTTP, see below) as the "data" parameter. | ||
| 568 | - * If you're developing your own custom protocol, be sure your separator can not occur naturally as | ||
| 569 | - * part of the data between separators. | ||
| 570 | - * For example, imagine you want to send several small documents over a socket. | ||
| 571 | - * Using CRLF as a separator is likely unwise, as a CRLF could easily exist within the documents. | ||
| 572 | - * In this particular example, it would be better to use a protocol similar to HTTP with | ||
| 573 | - * a header that includes the length of the document. | ||
| 574 | - * Also be careful that your separator cannot occur naturally as part of the encoding for a character. | ||
| 575 | - * | ||
| 576 | - * The given data (separator) parameter should be immutable. | ||
| 577 | - * For performance reasons, the socket will retain it, not copy it. | ||
| 578 | - * So if it is immutable, don't modify it while the socket is using it. | ||
| 579 | -**/ | ||
| 580 | -- (void)readDataToData:(NSData *)data withTimeout:(NSTimeInterval)timeout maxLength:(NSUInteger)length tag:(long)tag; | ||
| 581 | - | ||
| 582 | -/** | ||
| 583 | - * Reads bytes until (and including) the passed "data" parameter, which acts as a separator. | ||
| 584 | - * The bytes will be appended to the given byte buffer starting at the given offset. | ||
| 585 | - * The given buffer will automatically be increased in size if needed. | ||
| 586 | - * | ||
| 587 | - * If the timeout value is negative, the read operation will not use a timeout. | ||
| 588 | - * If the buffer if nil, a buffer will automatically be created for you. | ||
| 589 | - * | ||
| 590 | - * If maxLength is zero, no length restriction is enforced. | ||
| 591 | - * Otherwise if maxLength bytes are read without completing the read, | ||
| 592 | - * it is treated similarly to a timeout - the socket is closed with a GCDAsyncSocketReadMaxedOutError. | ||
| 593 | - * The read will complete successfully if exactly maxLength bytes are read and the given data is found at the end. | ||
| 594 | - * | ||
| 595 | - * If you pass a maxLength parameter that is less than the length of the data (separator) parameter, | ||
| 596 | - * the method will do nothing (except maybe print a warning), and the delegate will not be called. | ||
| 597 | - * If the bufferOffset is greater than the length of the given buffer, | ||
| 598 | - * the method will do nothing (except maybe print a warning), and the delegate will not be called. | ||
| 599 | - * | ||
| 600 | - * If you pass a buffer, you must not alter it in any way while the socket is using it. | ||
| 601 | - * After completion, the data returned in socket:didReadData:withTag: will be a subset of the given buffer. | ||
| 602 | - * That is, it will reference the bytes that were appended to the given buffer via | ||
| 603 | - * the method [NSData dataWithBytesNoCopy:length:freeWhenDone:NO]. | ||
| 604 | - * | ||
| 605 | - * To read a line from the socket, use the line separator (e.g. CRLF for HTTP, see below) as the "data" parameter. | ||
| 606 | - * If you're developing your own custom protocol, be sure your separator can not occur naturally as | ||
| 607 | - * part of the data between separators. | ||
| 608 | - * For example, imagine you want to send several small documents over a socket. | ||
| 609 | - * Using CRLF as a separator is likely unwise, as a CRLF could easily exist within the documents. | ||
| 610 | - * In this particular example, it would be better to use a protocol similar to HTTP with | ||
| 611 | - * a header that includes the length of the document. | ||
| 612 | - * Also be careful that your separator cannot occur naturally as part of the encoding for a character. | ||
| 613 | - * | ||
| 614 | - * The given data (separator) parameter should be immutable. | ||
| 615 | - * For performance reasons, the socket will retain it, not copy it. | ||
| 616 | - * So if it is immutable, don't modify it while the socket is using it. | ||
| 617 | -**/ | ||
| 618 | -- (void)readDataToData:(NSData *)data | ||
| 619 | - withTimeout:(NSTimeInterval)timeout | ||
| 620 | - buffer:(nullable NSMutableData *)buffer | ||
| 621 | - bufferOffset:(NSUInteger)offset | ||
| 622 | - maxLength:(NSUInteger)length | ||
| 623 | - tag:(long)tag; | ||
| 624 | - | ||
| 625 | -/** | ||
| 626 | - * Returns progress of the current read, from 0.0 to 1.0, or NaN if no current read (use isnan() to check). | ||
| 627 | - * The parameters "tag", "done" and "total" will be filled in if they aren't NULL. | ||
| 628 | -**/ | ||
| 629 | -- (float)progressOfReadReturningTag:(nullable long *)tagPtr bytesDone:(nullable NSUInteger *)donePtr total:(nullable NSUInteger *)totalPtr; | ||
| 630 | - | ||
| 631 | -#pragma mark Writing | ||
| 632 | - | ||
| 633 | -/** | ||
| 634 | - * Writes data to the socket, and calls the delegate when finished. | ||
| 635 | - * | ||
| 636 | - * If you pass in nil or zero-length data, this method does nothing and the delegate will not be called. | ||
| 637 | - * If the timeout value is negative, the write operation will not use a timeout. | ||
| 638 | - * | ||
| 639 | - * Thread-Safety Note: | ||
| 640 | - * If the given data parameter is mutable (NSMutableData) then you MUST NOT alter the data while | ||
| 641 | - * the socket is writing it. In other words, it's not safe to alter the data until after the delegate method | ||
| 642 | - * socket:didWriteDataWithTag: is invoked signifying that this particular write operation has completed. | ||
| 643 | - * This is due to the fact that GCDAsyncSocket does NOT copy the data. It simply retains it. | ||
| 644 | - * This is for performance reasons. Often times, if NSMutableData is passed, it is because | ||
| 645 | - * a request/response was built up in memory. Copying this data adds an unwanted/unneeded overhead. | ||
| 646 | - * If you need to write data from an immutable buffer, and you need to alter the buffer before the socket | ||
| 647 | - * completes writing the bytes (which is NOT immediately after this method returns, but rather at a later time | ||
| 648 | - * when the delegate method notifies you), then you should first copy the bytes, and pass the copy to this method. | ||
| 649 | -**/ | ||
| 650 | -- (void)writeData:(NSData *)data withTimeout:(NSTimeInterval)timeout tag:(long)tag; | ||
| 651 | - | ||
| 652 | -/** | ||
| 653 | - * Returns progress of the current write, from 0.0 to 1.0, or NaN if no current write (use isnan() to check). | ||
| 654 | - * The parameters "tag", "done" and "total" will be filled in if they aren't NULL. | ||
| 655 | -**/ | ||
| 656 | -- (float)progressOfWriteReturningTag:(nullable long *)tagPtr bytesDone:(nullable NSUInteger *)donePtr total:(nullable NSUInteger *)totalPtr; | ||
| 657 | - | ||
| 658 | -#pragma mark Security | ||
| 659 | - | ||
| 660 | -/** | ||
| 661 | - * Secures the connection using SSL/TLS. | ||
| 662 | - * | ||
| 663 | - * This method may be called at any time, and the TLS handshake will occur after all pending reads and writes | ||
| 664 | - * are finished. This allows one the option of sending a protocol dependent StartTLS message, and queuing | ||
| 665 | - * the upgrade to TLS at the same time, without having to wait for the write to finish. | ||
| 666 | - * Any reads or writes scheduled after this method is called will occur over the secured connection. | ||
| 667 | - * | ||
| 668 | - * ==== The available TOP-LEVEL KEYS are: | ||
| 669 | - * | ||
| 670 | - * - GCDAsyncSocketManuallyEvaluateTrust | ||
| 671 | - * The value must be of type NSNumber, encapsulating a BOOL value. | ||
| 672 | - * If you set this to YES, then the underlying SecureTransport system will not evaluate the SecTrustRef of the peer. | ||
| 673 | - * Instead it will pause at the moment evaulation would typically occur, | ||
| 674 | - * and allow us to handle the security evaluation however we see fit. | ||
| 675 | - * So GCDAsyncSocket will invoke the delegate method socket:shouldTrustPeer: passing the SecTrustRef. | ||
| 676 | - * | ||
| 677 | - * Note that if you set this option, then all other configuration keys are ignored. | ||
| 678 | - * Evaluation will be completely up to you during the socket:didReceiveTrust:completionHandler: delegate method. | ||
| 679 | - * | ||
| 680 | - * For more information on trust evaluation see: | ||
| 681 | - * Apple's Technical Note TN2232 - HTTPS Server Trust Evaluation | ||
| 682 | - * https://developer.apple.com/library/ios/technotes/tn2232/_index.html | ||
| 683 | - * | ||
| 684 | - * If unspecified, the default value is NO. | ||
| 685 | - * | ||
| 686 | - * - GCDAsyncSocketUseCFStreamForTLS (iOS only) | ||
| 687 | - * The value must be of type NSNumber, encapsulating a BOOL value. | ||
| 688 | - * By default GCDAsyncSocket will use the SecureTransport layer to perform encryption. | ||
| 689 | - * This gives us more control over the security protocol (many more configuration options), | ||
| 690 | - * plus it allows us to optimize things like sys calls and buffer allocation. | ||
| 691 | - * | ||
| 692 | - * However, if you absolutely must, you can instruct GCDAsyncSocket to use the old-fashioned encryption | ||
| 693 | - * technique by going through the CFStream instead. So instead of using SecureTransport, GCDAsyncSocket | ||
| 694 | - * will instead setup a CFRead/CFWriteStream. And then set the kCFStreamPropertySSLSettings property | ||
| 695 | - * (via CFReadStreamSetProperty / CFWriteStreamSetProperty) and will pass the given options to this method. | ||
| 696 | - * | ||
| 697 | - * Thus all the other keys in the given dictionary will be ignored by GCDAsyncSocket, | ||
| 698 | - * and will passed directly CFReadStreamSetProperty / CFWriteStreamSetProperty. | ||
| 699 | - * For more infomation on these keys, please see the documentation for kCFStreamPropertySSLSettings. | ||
| 700 | - * | ||
| 701 | - * If unspecified, the default value is NO. | ||
| 702 | - * | ||
| 703 | - * ==== The available CONFIGURATION KEYS are: | ||
| 704 | - * | ||
| 705 | - * - kCFStreamSSLPeerName | ||
| 706 | - * The value must be of type NSString. | ||
| 707 | - * It should match the name in the X.509 certificate given by the remote party. | ||
| 708 | - * See Apple's documentation for SSLSetPeerDomainName. | ||
| 709 | - * | ||
| 710 | - * - kCFStreamSSLCertificates | ||
| 711 | - * The value must be of type NSArray. | ||
| 712 | - * See Apple's documentation for SSLSetCertificate. | ||
| 713 | - * | ||
| 714 | - * - kCFStreamSSLIsServer | ||
| 715 | - * The value must be of type NSNumber, encapsulationg a BOOL value. | ||
| 716 | - * See Apple's documentation for SSLCreateContext for iOS. | ||
| 717 | - * This is optional for iOS. If not supplied, a NO value is the default. | ||
| 718 | - * This is not needed for Mac OS X, and the value is ignored. | ||
| 719 | - * | ||
| 720 | - * - GCDAsyncSocketSSLPeerID | ||
| 721 | - * The value must be of type NSData. | ||
| 722 | - * You must set this value if you want to use TLS session resumption. | ||
| 723 | - * See Apple's documentation for SSLSetPeerID. | ||
| 724 | - * | ||
| 725 | - * - GCDAsyncSocketSSLProtocolVersionMin | ||
| 726 | - * - GCDAsyncSocketSSLProtocolVersionMax | ||
| 727 | - * The value(s) must be of type NSNumber, encapsulting a SSLProtocol value. | ||
| 728 | - * See Apple's documentation for SSLSetProtocolVersionMin & SSLSetProtocolVersionMax. | ||
| 729 | - * See also the SSLProtocol typedef. | ||
| 730 | - * | ||
| 731 | - * - GCDAsyncSocketSSLSessionOptionFalseStart | ||
| 732 | - * The value must be of type NSNumber, encapsulating a BOOL value. | ||
| 733 | - * See Apple's documentation for kSSLSessionOptionFalseStart. | ||
| 734 | - * | ||
| 735 | - * - GCDAsyncSocketSSLSessionOptionSendOneByteRecord | ||
| 736 | - * The value must be of type NSNumber, encapsulating a BOOL value. | ||
| 737 | - * See Apple's documentation for kSSLSessionOptionSendOneByteRecord. | ||
| 738 | - * | ||
| 739 | - * - GCDAsyncSocketSSLCipherSuites | ||
| 740 | - * The values must be of type NSArray. | ||
| 741 | - * Each item within the array must be a NSNumber, encapsulating | ||
| 742 | - * See Apple's documentation for SSLSetEnabledCiphers. | ||
| 743 | - * See also the SSLCipherSuite typedef. | ||
| 744 | - * | ||
| 745 | - * - GCDAsyncSocketSSLDiffieHellmanParameters (Mac OS X only) | ||
| 746 | - * The value must be of type NSData. | ||
| 747 | - * See Apple's documentation for SSLSetDiffieHellmanParams. | ||
| 748 | - * | ||
| 749 | - * ==== The following UNAVAILABLE KEYS are: (with throw an exception) | ||
| 750 | - * | ||
| 751 | - * - kCFStreamSSLAllowsAnyRoot (UNAVAILABLE) | ||
| 752 | - * You MUST use manual trust evaluation instead (see GCDAsyncSocketManuallyEvaluateTrust). | ||
| 753 | - * Corresponding deprecated method: SSLSetAllowsAnyRoot | ||
| 754 | - * | ||
| 755 | - * - kCFStreamSSLAllowsExpiredRoots (UNAVAILABLE) | ||
| 756 | - * You MUST use manual trust evaluation instead (see GCDAsyncSocketManuallyEvaluateTrust). | ||
| 757 | - * Corresponding deprecated method: SSLSetAllowsExpiredRoots | ||
| 758 | - * | ||
| 759 | - * - kCFStreamSSLAllowsExpiredCertificates (UNAVAILABLE) | ||
| 760 | - * You MUST use manual trust evaluation instead (see GCDAsyncSocketManuallyEvaluateTrust). | ||
| 761 | - * Corresponding deprecated method: SSLSetAllowsExpiredCerts | ||
| 762 | - * | ||
| 763 | - * - kCFStreamSSLValidatesCertificateChain (UNAVAILABLE) | ||
| 764 | - * You MUST use manual trust evaluation instead (see GCDAsyncSocketManuallyEvaluateTrust). | ||
| 765 | - * Corresponding deprecated method: SSLSetEnableCertVerify | ||
| 766 | - * | ||
| 767 | - * - kCFStreamSSLLevel (UNAVAILABLE) | ||
| 768 | - * You MUST use GCDAsyncSocketSSLProtocolVersionMin & GCDAsyncSocketSSLProtocolVersionMin instead. | ||
| 769 | - * Corresponding deprecated method: SSLSetProtocolVersionEnabled | ||
| 770 | - * | ||
| 771 | - * | ||
| 772 | - * Please refer to Apple's documentation for corresponding SSLFunctions. | ||
| 773 | - * | ||
| 774 | - * If you pass in nil or an empty dictionary, the default settings will be used. | ||
| 775 | - * | ||
| 776 | - * IMPORTANT SECURITY NOTE: | ||
| 777 | - * The default settings will check to make sure the remote party's certificate is signed by a | ||
| 778 | - * trusted 3rd party certificate agency (e.g. verisign) and that the certificate is not expired. | ||
| 779 | - * However it will not verify the name on the certificate unless you | ||
| 780 | - * give it a name to verify against via the kCFStreamSSLPeerName key. | ||
| 781 | - * The security implications of this are important to understand. | ||
| 782 | - * Imagine you are attempting to create a secure connection to MySecureServer.com, | ||
| 783 | - * but your socket gets directed to MaliciousServer.com because of a hacked DNS server. | ||
| 784 | - * If you simply use the default settings, and MaliciousServer.com has a valid certificate, | ||
| 785 | - * the default settings will not detect any problems since the certificate is valid. | ||
| 786 | - * To properly secure your connection in this particular scenario you | ||
| 787 | - * should set the kCFStreamSSLPeerName property to "MySecureServer.com". | ||
| 788 | - * | ||
| 789 | - * You can also perform additional validation in socketDidSecure. | ||
| 790 | -**/ | ||
| 791 | -- (void)startTLS:(nullable NSDictionary <NSString*,NSNumber*>*)tlsSettings; | ||
| 792 | - | ||
| 793 | -#pragma mark Advanced | ||
| 794 | - | ||
| 795 | -/** | ||
| 796 | - * Traditionally sockets are not closed until the conversation is over. | ||
| 797 | - * However, it is technically possible for the remote enpoint to close its write stream. | ||
| 798 | - * Our socket would then be notified that there is no more data to be read, | ||
| 799 | - * but our socket would still be writeable and the remote endpoint could continue to receive our data. | ||
| 800 | - * | ||
| 801 | - * The argument for this confusing functionality stems from the idea that a client could shut down its | ||
| 802 | - * write stream after sending a request to the server, thus notifying the server there are to be no further requests. | ||
| 803 | - * In practice, however, this technique did little to help server developers. | ||
| 804 | - * | ||
| 805 | - * To make matters worse, from a TCP perspective there is no way to tell the difference from a read stream close | ||
| 806 | - * and a full socket close. They both result in the TCP stack receiving a FIN packet. The only way to tell | ||
| 807 | - * is by continuing to write to the socket. If it was only a read stream close, then writes will continue to work. | ||
| 808 | - * Otherwise an error will be occur shortly (when the remote end sends us a RST packet). | ||
| 809 | - * | ||
| 810 | - * In addition to the technical challenges and confusion, many high level socket/stream API's provide | ||
| 811 | - * no support for dealing with the problem. If the read stream is closed, the API immediately declares the | ||
| 812 | - * socket to be closed, and shuts down the write stream as well. In fact, this is what Apple's CFStream API does. | ||
| 813 | - * It might sound like poor design at first, but in fact it simplifies development. | ||
| 814 | - * | ||
| 815 | - * The vast majority of the time if the read stream is closed it's because the remote endpoint closed its socket. | ||
| 816 | - * Thus it actually makes sense to close the socket at this point. | ||
| 817 | - * And in fact this is what most networking developers want and expect to happen. | ||
| 818 | - * However, if you are writing a server that interacts with a plethora of clients, | ||
| 819 | - * you might encounter a client that uses the discouraged technique of shutting down its write stream. | ||
| 820 | - * If this is the case, you can set this property to NO, | ||
| 821 | - * and make use of the socketDidCloseReadStream delegate method. | ||
| 822 | - * | ||
| 823 | - * The default value is YES. | ||
| 824 | -**/ | ||
| 825 | -@property (atomic, assign, readwrite) BOOL autoDisconnectOnClosedReadStream; | ||
| 826 | - | ||
| 827 | -/** | ||
| 828 | - * GCDAsyncSocket maintains thread safety by using an internal serial dispatch_queue. | ||
| 829 | - * In most cases, the instance creates this queue itself. | ||
| 830 | - * However, to allow for maximum flexibility, the internal queue may be passed in the init method. | ||
| 831 | - * This allows for some advanced options such as controlling socket priority via target queues. | ||
| 832 | - * However, when one begins to use target queues like this, they open the door to some specific deadlock issues. | ||
| 833 | - * | ||
| 834 | - * For example, imagine there are 2 queues: | ||
| 835 | - * dispatch_queue_t socketQueue; | ||
| 836 | - * dispatch_queue_t socketTargetQueue; | ||
| 837 | - * | ||
| 838 | - * If you do this (pseudo-code): | ||
| 839 | - * socketQueue.targetQueue = socketTargetQueue; | ||
| 840 | - * | ||
| 841 | - * Then all socketQueue operations will actually get run on the given socketTargetQueue. | ||
| 842 | - * This is fine and works great in most situations. | ||
| 843 | - * But if you run code directly from within the socketTargetQueue that accesses the socket, | ||
| 844 | - * you could potentially get deadlock. Imagine the following code: | ||
| 845 | - * | ||
| 846 | - * - (BOOL)socketHasSomething | ||
| 847 | - * { | ||
| 848 | - * __block BOOL result = NO; | ||
| 849 | - * dispatch_block_t block = ^{ | ||
| 850 | - * result = [self someInternalMethodToBeRunOnlyOnSocketQueue]; | ||
| 851 | - * } | ||
| 852 | - * if (is_executing_on_queue(socketQueue)) | ||
| 853 | - * block(); | ||
| 854 | - * else | ||
| 855 | - * dispatch_sync(socketQueue, block); | ||
| 856 | - * | ||
| 857 | - * return result; | ||
| 858 | - * } | ||
| 859 | - * | ||
| 860 | - * What happens if you call this method from the socketTargetQueue? The result is deadlock. | ||
| 861 | - * This is because the GCD API offers no mechanism to discover a queue's targetQueue. | ||
| 862 | - * Thus we have no idea if our socketQueue is configured with a targetQueue. | ||
| 863 | - * If we had this information, we could easily avoid deadlock. | ||
| 864 | - * But, since these API's are missing or unfeasible, you'll have to explicitly set it. | ||
| 865 | - * | ||
| 866 | - * IF you pass a socketQueue via the init method, | ||
| 867 | - * AND you've configured the passed socketQueue with a targetQueue, | ||
| 868 | - * THEN you should pass the end queue in the target hierarchy. | ||
| 869 | - * | ||
| 870 | - * For example, consider the following queue hierarchy: | ||
| 871 | - * socketQueue -> ipQueue -> moduleQueue | ||
| 872 | - * | ||
| 873 | - * This example demonstrates priority shaping within some server. | ||
| 874 | - * All incoming client connections from the same IP address are executed on the same target queue. | ||
| 875 | - * And all connections for a particular module are executed on the same target queue. | ||
| 876 | - * Thus, the priority of all networking for the entire module can be changed on the fly. | ||
| 877 | - * Additionally, networking traffic from a single IP cannot monopolize the module. | ||
| 878 | - * | ||
| 879 | - * Here's how you would accomplish something like that: | ||
| 880 | - * - (dispatch_queue_t)newSocketQueueForConnectionFromAddress:(NSData *)address onSocket:(GCDAsyncSocket *)sock | ||
| 881 | - * { | ||
| 882 | - * dispatch_queue_t socketQueue = dispatch_queue_create("", NULL); | ||
| 883 | - * dispatch_queue_t ipQueue = [self ipQueueForAddress:address]; | ||
| 884 | - * | ||
| 885 | - * dispatch_set_target_queue(socketQueue, ipQueue); | ||
| 886 | - * dispatch_set_target_queue(iqQueue, moduleQueue); | ||
| 887 | - * | ||
| 888 | - * return socketQueue; | ||
| 889 | - * } | ||
| 890 | - * - (void)socket:(GCDAsyncSocket *)sock didAcceptNewSocket:(GCDAsyncSocket *)newSocket | ||
| 891 | - * { | ||
| 892 | - * [clientConnections addObject:newSocket]; | ||
| 893 | - * [newSocket markSocketQueueTargetQueue:moduleQueue]; | ||
| 894 | - * } | ||
| 895 | - * | ||
| 896 | - * Note: This workaround is ONLY needed if you intend to execute code directly on the ipQueue or moduleQueue. | ||
| 897 | - * This is often NOT the case, as such queues are used solely for execution shaping. | ||
| 898 | -**/ | ||
| 899 | -- (void)markSocketQueueTargetQueue:(dispatch_queue_t)socketQueuesPreConfiguredTargetQueue; | ||
| 900 | -- (void)unmarkSocketQueueTargetQueue:(dispatch_queue_t)socketQueuesPreviouslyConfiguredTargetQueue; | ||
| 901 | - | ||
| 902 | -/** | ||
| 903 | - * It's not thread-safe to access certain variables from outside the socket's internal queue. | ||
| 904 | - * | ||
| 905 | - * For example, the socket file descriptor. | ||
| 906 | - * File descriptors are simply integers which reference an index in the per-process file table. | ||
| 907 | - * However, when one requests a new file descriptor (by opening a file or socket), | ||
| 908 | - * the file descriptor returned is guaranteed to be the lowest numbered unused descriptor. | ||
| 909 | - * So if we're not careful, the following could be possible: | ||
| 910 | - * | ||
| 911 | - * - Thread A invokes a method which returns the socket's file descriptor. | ||
| 912 | - * - The socket is closed via the socket's internal queue on thread B. | ||
| 913 | - * - Thread C opens a file, and subsequently receives the file descriptor that was previously the socket's FD. | ||
| 914 | - * - Thread A is now accessing/altering the file instead of the socket. | ||
| 915 | - * | ||
| 916 | - * In addition to this, other variables are not actually objects, | ||
| 917 | - * and thus cannot be retained/released or even autoreleased. | ||
| 918 | - * An example is the sslContext, of type SSLContextRef, which is actually a malloc'd struct. | ||
| 919 | - * | ||
| 920 | - * Although there are internal variables that make it difficult to maintain thread-safety, | ||
| 921 | - * it is important to provide access to these variables | ||
| 922 | - * to ensure this class can be used in a wide array of environments. | ||
| 923 | - * This method helps to accomplish this by invoking the current block on the socket's internal queue. | ||
| 924 | - * The methods below can be invoked from within the block to access | ||
| 925 | - * those generally thread-unsafe internal variables in a thread-safe manner. | ||
| 926 | - * The given block will be invoked synchronously on the socket's internal queue. | ||
| 927 | - * | ||
| 928 | - * If you save references to any protected variables and use them outside the block, you do so at your own peril. | ||
| 929 | -**/ | ||
| 930 | -- (void)performBlock:(dispatch_block_t)block; | ||
| 931 | - | ||
| 932 | -/** | ||
| 933 | - * These methods are only available from within the context of a performBlock: invocation. | ||
| 934 | - * See the documentation for the performBlock: method above. | ||
| 935 | - * | ||
| 936 | - * Provides access to the socket's file descriptor(s). | ||
| 937 | - * If the socket is a server socket (is accepting incoming connections), | ||
| 938 | - * it might actually have multiple internal socket file descriptors - one for IPv4 and one for IPv6. | ||
| 939 | -**/ | ||
| 940 | -- (int)socketFD; | ||
| 941 | -- (int)socket4FD; | ||
| 942 | -- (int)socket6FD; | ||
| 943 | - | ||
| 944 | -#if TARGET_OS_IPHONE | ||
| 945 | - | ||
| 946 | -/** | ||
| 947 | - * These methods are only available from within the context of a performBlock: invocation. | ||
| 948 | - * See the documentation for the performBlock: method above. | ||
| 949 | - * | ||
| 950 | - * Provides access to the socket's internal CFReadStream/CFWriteStream. | ||
| 951 | - * | ||
| 952 | - * These streams are only used as workarounds for specific iOS shortcomings: | ||
| 953 | - * | ||
| 954 | - * - Apple has decided to keep the SecureTransport framework private is iOS. | ||
| 955 | - * This means the only supplied way to do SSL/TLS is via CFStream or some other API layered on top of it. | ||
| 956 | - * Thus, in order to provide SSL/TLS support on iOS we are forced to rely on CFStream, | ||
| 957 | - * instead of the preferred and faster and more powerful SecureTransport. | ||
| 958 | - * | ||
| 959 | - * - If a socket doesn't have backgrounding enabled, and that socket is closed while the app is backgrounded, | ||
| 960 | - * Apple only bothers to notify us via the CFStream API. | ||
| 961 | - * The faster and more powerful GCD API isn't notified properly in this case. | ||
| 962 | - * | ||
| 963 | - * See also: (BOOL)enableBackgroundingOnSocket | ||
| 964 | -**/ | ||
| 965 | -- (CFReadStreamRef)readStream; | ||
| 966 | -- (CFWriteStreamRef)writeStream; | ||
| 967 | - | ||
| 968 | -/** | ||
| 969 | - * This method is only available from within the context of a performBlock: invocation. | ||
| 970 | - * See the documentation for the performBlock: method above. | ||
| 971 | - * | ||
| 972 | - * Configures the socket to allow it to operate when the iOS application has been backgrounded. | ||
| 973 | - * In other words, this method creates a read & write stream, and invokes: | ||
| 974 | - * | ||
| 975 | - * CFReadStreamSetProperty(readStream, kCFStreamNetworkServiceType, kCFStreamNetworkServiceTypeVoIP); | ||
| 976 | - * CFWriteStreamSetProperty(writeStream, kCFStreamNetworkServiceType, kCFStreamNetworkServiceTypeVoIP); | ||
| 977 | - * | ||
| 978 | - * Returns YES if successful, NO otherwise. | ||
| 979 | - * | ||
| 980 | - * Note: Apple does not officially support backgrounding server sockets. | ||
| 981 | - * That is, if your socket is accepting incoming connections, Apple does not officially support | ||
| 982 | - * allowing iOS applications to accept incoming connections while an app is backgrounded. | ||
| 983 | - * | ||
| 984 | - * Example usage: | ||
| 985 | - * | ||
| 986 | - * - (void)socket:(GCDAsyncSocket *)sock didConnectToHost:(NSString *)host port:(uint16_t)port | ||
| 987 | - * { | ||
| 988 | - * [asyncSocket performBlock:^{ | ||
| 989 | - * [asyncSocket enableBackgroundingOnSocket]; | ||
| 990 | - * }]; | ||
| 991 | - * } | ||
| 992 | -**/ | ||
| 993 | -- (BOOL)enableBackgroundingOnSocket; | ||
| 994 | - | ||
| 995 | -#endif | ||
| 996 | - | ||
| 997 | -/** | ||
| 998 | - * This method is only available from within the context of a performBlock: invocation. | ||
| 999 | - * See the documentation for the performBlock: method above. | ||
| 1000 | - * | ||
| 1001 | - * Provides access to the socket's SSLContext, if SSL/TLS has been started on the socket. | ||
| 1002 | -**/ | ||
| 1003 | -- (SSLContextRef)sslContext; | ||
| 1004 | - | ||
| 1005 | -#pragma mark Utilities | ||
| 1006 | - | ||
| 1007 | -/** | ||
| 1008 | - * The address lookup utility used by the class. | ||
| 1009 | - * This method is synchronous, so it's recommended you use it on a background thread/queue. | ||
| 1010 | - * | ||
| 1011 | - * The special strings "localhost" and "loopback" return the loopback address for IPv4 and IPv6. | ||
| 1012 | - * | ||
| 1013 | - * @returns | ||
| 1014 | - * A mutable array with all IPv4 and IPv6 addresses returned by getaddrinfo. | ||
| 1015 | - * The addresses are specifically for TCP connections. | ||
| 1016 | - * You can filter the addresses, if needed, using the other utility methods provided by the class. | ||
| 1017 | -**/ | ||
| 1018 | -+ (nullable NSMutableArray *)lookupHost:(NSString *)host port:(uint16_t)port error:(NSError **)errPtr; | ||
| 1019 | - | ||
| 1020 | -/** | ||
| 1021 | - * Extracting host and port information from raw address data. | ||
| 1022 | -**/ | ||
| 1023 | - | ||
| 1024 | -+ (nullable NSString *)hostFromAddress:(NSData *)address; | ||
| 1025 | -+ (uint16_t)portFromAddress:(NSData *)address; | ||
| 1026 | - | ||
| 1027 | -+ (BOOL)isIPv4Address:(NSData *)address; | ||
| 1028 | -+ (BOOL)isIPv6Address:(NSData *)address; | ||
| 1029 | - | ||
| 1030 | -+ (BOOL)getHost:( NSString * __nullable * __nullable)hostPtr port:(nullable uint16_t *)portPtr fromAddress:(NSData *)address; | ||
| 1031 | - | ||
| 1032 | -+ (BOOL)getHost:(NSString * __nullable * __nullable)hostPtr port:(nullable uint16_t *)portPtr family:(nullable sa_family_t *)afPtr fromAddress:(NSData *)address; | ||
| 1033 | - | ||
| 1034 | -/** | ||
| 1035 | - * A few common line separators, for use with the readDataToData:... methods. | ||
| 1036 | -**/ | ||
| 1037 | -+ (NSData *)CRLFData; // 0x0D0A | ||
| 1038 | -+ (NSData *)CRData; // 0x0D | ||
| 1039 | -+ (NSData *)LFData; // 0x0A | ||
| 1040 | -+ (NSData *)ZeroData; // 0x00 | ||
| 1041 | - | ||
| 1042 | -@end | ||
| 1043 | - | ||
| 1044 | -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
| 1045 | -#pragma mark - | ||
| 1046 | -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
| 1047 | - | ||
| 1048 | -@protocol GCDAsyncSocketDelegate | ||
| 1049 | -@optional | ||
| 1050 | - | ||
| 1051 | -/** | ||
| 1052 | - * This method is called immediately prior to socket:didAcceptNewSocket:. | ||
| 1053 | - * It optionally allows a listening socket to specify the socketQueue for a new accepted socket. | ||
| 1054 | - * If this method is not implemented, or returns NULL, the new accepted socket will create its own default queue. | ||
| 1055 | - * | ||
| 1056 | - * Since you cannot autorelease a dispatch_queue, | ||
| 1057 | - * this method uses the "new" prefix in its name to specify that the returned queue has been retained. | ||
| 1058 | - * | ||
| 1059 | - * Thus you could do something like this in the implementation: | ||
| 1060 | - * return dispatch_queue_create("MyQueue", NULL); | ||
| 1061 | - * | ||
| 1062 | - * If you are placing multiple sockets on the same queue, | ||
| 1063 | - * then care should be taken to increment the retain count each time this method is invoked. | ||
| 1064 | - * | ||
| 1065 | - * For example, your implementation might look something like this: | ||
| 1066 | - * dispatch_retain(myExistingQueue); | ||
| 1067 | - * return myExistingQueue; | ||
| 1068 | -**/ | ||
| 1069 | -- (nullable dispatch_queue_t)newSocketQueueForConnectionFromAddress:(NSData *)address onSocket:(GCDAsyncSocket *)sock; | ||
| 1070 | - | ||
| 1071 | -/** | ||
| 1072 | - * Called when a socket accepts a connection. | ||
| 1073 | - * Another socket is automatically spawned to handle it. | ||
| 1074 | - * | ||
| 1075 | - * You must retain the newSocket if you wish to handle the connection. | ||
| 1076 | - * Otherwise the newSocket instance will be released and the spawned connection will be closed. | ||
| 1077 | - * | ||
| 1078 | - * By default the new socket will have the same delegate and delegateQueue. | ||
| 1079 | - * You may, of course, change this at any time. | ||
| 1080 | -**/ | ||
| 1081 | -- (void)socket:(GCDAsyncSocket *)sock didAcceptNewSocket:(GCDAsyncSocket *)newSocket; | ||
| 1082 | - | ||
| 1083 | -/** | ||
| 1084 | - * Called when a socket connects and is ready for reading and writing. | ||
| 1085 | - * The host parameter will be an IP address, not a DNS name. | ||
| 1086 | -**/ | ||
| 1087 | -- (void)socket:(GCDAsyncSocket *)sock didConnectToHost:(NSString *)host port:(uint16_t)port; | ||
| 1088 | - | ||
| 1089 | -/** | ||
| 1090 | - * Called when a socket connects and is ready for reading and writing. | ||
| 1091 | - * The host parameter will be an IP address, not a DNS name. | ||
| 1092 | - **/ | ||
| 1093 | -- (void)socket:(GCDAsyncSocket *)sock didConnectToUrl:(NSURL *)url; | ||
| 1094 | - | ||
| 1095 | -/** | ||
| 1096 | - * Called when a socket has completed reading the requested data into memory. | ||
| 1097 | - * Not called if there is an error. | ||
| 1098 | -**/ | ||
| 1099 | -- (void)socket:(GCDAsyncSocket *)sock didReadData:(NSData *)data withTag:(long)tag; | ||
| 1100 | - | ||
| 1101 | -/** | ||
| 1102 | - * Called when a socket has read in data, but has not yet completed the read. | ||
| 1103 | - * This would occur if using readToData: or readToLength: methods. | ||
| 1104 | - * It may be used to for things such as updating progress bars. | ||
| 1105 | -**/ | ||
| 1106 | -- (void)socket:(GCDAsyncSocket *)sock didReadPartialDataOfLength:(NSUInteger)partialLength tag:(long)tag; | ||
| 1107 | - | ||
| 1108 | -/** | ||
| 1109 | - * Called when a socket has completed writing the requested data. Not called if there is an error. | ||
| 1110 | -**/ | ||
| 1111 | -- (void)socket:(GCDAsyncSocket *)sock didWriteDataWithTag:(long)tag; | ||
| 1112 | - | ||
| 1113 | -/** | ||
| 1114 | - * Called when a socket has written some data, but has not yet completed the entire write. | ||
| 1115 | - * It may be used to for things such as updating progress bars. | ||
| 1116 | -**/ | ||
| 1117 | -- (void)socket:(GCDAsyncSocket *)sock didWritePartialDataOfLength:(NSUInteger)partialLength tag:(long)tag; | ||
| 1118 | - | ||
| 1119 | -/** | ||
| 1120 | - * Called if a read operation has reached its timeout without completing. | ||
| 1121 | - * This method allows you to optionally extend the timeout. | ||
| 1122 | - * If you return a positive time interval (> 0) the read's timeout will be extended by the given amount. | ||
| 1123 | - * If you don't implement this method, or return a non-positive time interval (<= 0) the read will timeout as usual. | ||
| 1124 | - * | ||
| 1125 | - * The elapsed parameter is the sum of the original timeout, plus any additions previously added via this method. | ||
| 1126 | - * The length parameter is the number of bytes that have been read so far for the read operation. | ||
| 1127 | - * | ||
| 1128 | - * Note that this method may be called multiple times for a single read if you return positive numbers. | ||
| 1129 | -**/ | ||
| 1130 | -- (NSTimeInterval)socket:(GCDAsyncSocket *)sock shouldTimeoutReadWithTag:(long)tag | ||
| 1131 | - elapsed:(NSTimeInterval)elapsed | ||
| 1132 | - bytesDone:(NSUInteger)length; | ||
| 1133 | - | ||
| 1134 | -/** | ||
| 1135 | - * Called if a write operation has reached its timeout without completing. | ||
| 1136 | - * This method allows you to optionally extend the timeout. | ||
| 1137 | - * If you return a positive time interval (> 0) the write's timeout will be extended by the given amount. | ||
| 1138 | - * If you don't implement this method, or return a non-positive time interval (<= 0) the write will timeout as usual. | ||
| 1139 | - * | ||
| 1140 | - * The elapsed parameter is the sum of the original timeout, plus any additions previously added via this method. | ||
| 1141 | - * The length parameter is the number of bytes that have been written so far for the write operation. | ||
| 1142 | - * | ||
| 1143 | - * Note that this method may be called multiple times for a single write if you return positive numbers. | ||
| 1144 | -**/ | ||
| 1145 | -- (NSTimeInterval)socket:(GCDAsyncSocket *)sock shouldTimeoutWriteWithTag:(long)tag | ||
| 1146 | - elapsed:(NSTimeInterval)elapsed | ||
| 1147 | - bytesDone:(NSUInteger)length; | ||
| 1148 | - | ||
| 1149 | -/** | ||
| 1150 | - * Conditionally called if the read stream closes, but the write stream may still be writeable. | ||
| 1151 | - * | ||
| 1152 | - * This delegate method is only called if autoDisconnectOnClosedReadStream has been set to NO. | ||
| 1153 | - * See the discussion on the autoDisconnectOnClosedReadStream method for more information. | ||
| 1154 | -**/ | ||
| 1155 | -- (void)socketDidCloseReadStream:(GCDAsyncSocket *)sock; | ||
| 1156 | - | ||
| 1157 | -/** | ||
| 1158 | - * Called when a socket disconnects with or without error. | ||
| 1159 | - * | ||
| 1160 | - * If you call the disconnect method, and the socket wasn't already disconnected, | ||
| 1161 | - * then an invocation of this delegate method will be enqueued on the delegateQueue | ||
| 1162 | - * before the disconnect method returns. | ||
| 1163 | - * | ||
| 1164 | - * Note: If the GCDAsyncSocket instance is deallocated while it is still connected, | ||
| 1165 | - * and the delegate is not also deallocated, then this method will be invoked, | ||
| 1166 | - * but the sock parameter will be nil. (It must necessarily be nil since it is no longer available.) | ||
| 1167 | - * This is a generally rare, but is possible if one writes code like this: | ||
| 1168 | - * | ||
| 1169 | - * asyncSocket = nil; // I'm implicitly disconnecting the socket | ||
| 1170 | - * | ||
| 1171 | - * In this case it may preferrable to nil the delegate beforehand, like this: | ||
| 1172 | - * | ||
| 1173 | - * asyncSocket.delegate = nil; // Don't invoke my delegate method | ||
| 1174 | - * asyncSocket = nil; // I'm implicitly disconnecting the socket | ||
| 1175 | - * | ||
| 1176 | - * Of course, this depends on how your state machine is configured. | ||
| 1177 | -**/ | ||
| 1178 | -- (void)socketDidDisconnect:(GCDAsyncSocket *)sock withError:(nullable NSError *)err; | ||
| 1179 | - | ||
| 1180 | -/** | ||
| 1181 | - * Called after the socket has successfully completed SSL/TLS negotiation. | ||
| 1182 | - * This method is not called unless you use the provided startTLS method. | ||
| 1183 | - * | ||
| 1184 | - * If a SSL/TLS negotiation fails (invalid certificate, etc) then the socket will immediately close, | ||
| 1185 | - * and the socketDidDisconnect:withError: delegate method will be called with the specific SSL error code. | ||
| 1186 | -**/ | ||
| 1187 | -- (void)socketDidSecure:(GCDAsyncSocket *)sock; | ||
| 1188 | - | ||
| 1189 | -/** | ||
| 1190 | - * Allows a socket delegate to hook into the TLS handshake and manually validate the peer it's connecting to. | ||
| 1191 | - * | ||
| 1192 | - * This is only called if startTLS is invoked with options that include: | ||
| 1193 | - * - GCDAsyncSocketManuallyEvaluateTrust == YES | ||
| 1194 | - * | ||
| 1195 | - * Typically the delegate will use SecTrustEvaluate (and related functions) to properly validate the peer. | ||
| 1196 | - * | ||
| 1197 | - * Note from Apple's documentation: | ||
| 1198 | - * Because [SecTrustEvaluate] might look on the network for certificates in the certificate chain, | ||
| 1199 | - * [it] might block while attempting network access. You should never call it from your main thread; | ||
| 1200 | - * call it only from within a function running on a dispatch queue or on a separate thread. | ||
| 1201 | - * | ||
| 1202 | - * Thus this method uses a completionHandler block rather than a normal return value. | ||
| 1203 | - * The completionHandler block is thread-safe, and may be invoked from a background queue/thread. | ||
| 1204 | - * It is safe to invoke the completionHandler block even if the socket has been closed. | ||
| 1205 | -**/ | ||
| 1206 | -- (void)socket:(GCDAsyncSocket *)sock didReceiveTrust:(SecTrustRef)trust | ||
| 1207 | - completionHandler:(void (^)(BOOL shouldTrustPeer))completionHandler; | ||
| 1208 | - | ||
| 1209 | -@end | ||
| 1210 | -NS_ASSUME_NONNULL_END |
CNLiveXMPPManagerDemo/CocoaAsyncSocket.framework/Headers/GCDAsyncUdpSocket.h deleted
100644 → 0
| 1 | -// | ||
| 2 | -// GCDAsyncUdpSocket | ||
| 3 | -// | ||
| 4 | -// This class is in the public domain. | ||
| 5 | -// Originally created by Robbie Hanson of Deusty LLC. | ||
| 6 | -// Updated and maintained by Deusty LLC and the Apple development community. | ||
| 7 | -// | ||
| 8 | -// https://github.com/robbiehanson/CocoaAsyncSocket | ||
| 9 | -// | ||
| 10 | - | ||
| 11 | -#import <Foundation/Foundation.h> | ||
| 12 | -#import <dispatch/dispatch.h> | ||
| 13 | -#import <TargetConditionals.h> | ||
| 14 | -#import <Availability.h> | ||
| 15 | - | ||
| 16 | -NS_ASSUME_NONNULL_BEGIN | ||
| 17 | -extern NSString *const GCDAsyncUdpSocketException; | ||
| 18 | -extern NSString *const GCDAsyncUdpSocketErrorDomain; | ||
| 19 | - | ||
| 20 | -extern NSString *const GCDAsyncUdpSocketQueueName; | ||
| 21 | -extern NSString *const GCDAsyncUdpSocketThreadName; | ||
| 22 | - | ||
| 23 | -typedef NS_ENUM(NSInteger, GCDAsyncUdpSocketError) { | ||
| 24 | - GCDAsyncUdpSocketNoError = 0, // Never used | ||
| 25 | - GCDAsyncUdpSocketBadConfigError, // Invalid configuration | ||
| 26 | - GCDAsyncUdpSocketBadParamError, // Invalid parameter was passed | ||
| 27 | - GCDAsyncUdpSocketSendTimeoutError, // A send operation timed out | ||
| 28 | - GCDAsyncUdpSocketClosedError, // The socket was closed | ||
| 29 | - GCDAsyncUdpSocketOtherError, // Description provided in userInfo | ||
| 30 | -}; | ||
| 31 | - | ||
| 32 | -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
| 33 | -#pragma mark - | ||
| 34 | -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
| 35 | - | ||
| 36 | -@class GCDAsyncUdpSocket; | ||
| 37 | - | ||
| 38 | -@protocol GCDAsyncUdpSocketDelegate | ||
| 39 | -@optional | ||
| 40 | - | ||
| 41 | -/** | ||
| 42 | - * By design, UDP is a connectionless protocol, and connecting is not needed. | ||
| 43 | - * However, you may optionally choose to connect to a particular host for reasons | ||
| 44 | - * outlined in the documentation for the various connect methods listed above. | ||
| 45 | - * | ||
| 46 | - * This method is called if one of the connect methods are invoked, and the connection is successful. | ||
| 47 | -**/ | ||
| 48 | -- (void)udpSocket:(GCDAsyncUdpSocket *)sock didConnectToAddress:(NSData *)address; | ||
| 49 | - | ||
| 50 | -/** | ||
| 51 | - * By design, UDP is a connectionless protocol, and connecting is not needed. | ||
| 52 | - * However, you may optionally choose to connect to a particular host for reasons | ||
| 53 | - * outlined in the documentation for the various connect methods listed above. | ||
| 54 | - * | ||
| 55 | - * This method is called if one of the connect methods are invoked, and the connection fails. | ||
| 56 | - * This may happen, for example, if a domain name is given for the host and the domain name is unable to be resolved. | ||
| 57 | -**/ | ||
| 58 | -- (void)udpSocket:(GCDAsyncUdpSocket *)sock didNotConnect:(NSError *)error; | ||
| 59 | - | ||
| 60 | -/** | ||
| 61 | - * Called when the datagram with the given tag has been sent. | ||
| 62 | -**/ | ||
| 63 | -- (void)udpSocket:(GCDAsyncUdpSocket *)sock didSendDataWithTag:(long)tag; | ||
| 64 | - | ||
| 65 | -/** | ||
| 66 | - * Called if an error occurs while trying to send a datagram. | ||
| 67 | - * This could be due to a timeout, or something more serious such as the data being too large to fit in a sigle packet. | ||
| 68 | -**/ | ||
| 69 | -- (void)udpSocket:(GCDAsyncUdpSocket *)sock didNotSendDataWithTag:(long)tag dueToError:(NSError *)error; | ||
| 70 | - | ||
| 71 | -/** | ||
| 72 | - * Called when the socket has received the requested datagram. | ||
| 73 | -**/ | ||
| 74 | -- (void)udpSocket:(GCDAsyncUdpSocket *)sock didReceiveData:(NSData *)data | ||
| 75 | - fromAddress:(NSData *)address | ||
| 76 | - withFilterContext:(nullable id)filterContext; | ||
| 77 | - | ||
| 78 | -/** | ||
| 79 | - * Called when the socket is closed. | ||
| 80 | -**/ | ||
| 81 | -- (void)udpSocketDidClose:(GCDAsyncUdpSocket *)sock withError:(NSError *)error; | ||
| 82 | - | ||
| 83 | -@end | ||
| 84 | - | ||
| 85 | -/** | ||
| 86 | - * You may optionally set a receive filter for the socket. | ||
| 87 | - * A filter can provide several useful features: | ||
| 88 | - * | ||
| 89 | - * 1. Many times udp packets need to be parsed. | ||
| 90 | - * Since the filter can run in its own independent queue, you can parallelize this parsing quite easily. | ||
| 91 | - * The end result is a parallel socket io, datagram parsing, and packet processing. | ||
| 92 | - * | ||
| 93 | - * 2. Many times udp packets are discarded because they are duplicate/unneeded/unsolicited. | ||
| 94 | - * The filter can prevent such packets from arriving at the delegate. | ||
| 95 | - * And because the filter can run in its own independent queue, this doesn't slow down the delegate. | ||
| 96 | - * | ||
| 97 | - * - Since the udp protocol does not guarantee delivery, udp packets may be lost. | ||
| 98 | - * Many protocols built atop udp thus provide various resend/re-request algorithms. | ||
| 99 | - * This sometimes results in duplicate packets arriving. | ||
| 100 | - * A filter may allow you to architect the duplicate detection code to run in parallel to normal processing. | ||
| 101 | - * | ||
| 102 | - * - Since the udp socket may be connectionless, its possible for unsolicited packets to arrive. | ||
| 103 | - * Such packets need to be ignored. | ||
| 104 | - * | ||
| 105 | - * 3. Sometimes traffic shapers are needed to simulate real world environments. | ||
| 106 | - * A filter allows you to write custom code to simulate such environments. | ||
| 107 | - * The ability to code this yourself is especially helpful when your simulated environment | ||
| 108 | - * is more complicated than simple traffic shaping (e.g. simulating a cone port restricted router), | ||
| 109 | - * or the system tools to handle this aren't available (e.g. on a mobile device). | ||
| 110 | - * | ||
| 111 | - * @param data - The packet that was received. | ||
| 112 | - * @param address - The address the data was received from. | ||
| 113 | - * See utilities section for methods to extract info from address. | ||
| 114 | - * @param context - Out parameter you may optionally set, which will then be passed to the delegate method. | ||
| 115 | - * For example, filter block can parse the data and then, | ||
| 116 | - * pass the parsed data to the delegate. | ||
| 117 | - * | ||
| 118 | - * @returns - YES if the received packet should be passed onto the delegate. | ||
| 119 | - * NO if the received packet should be discarded, and not reported to the delegete. | ||
| 120 | - * | ||
| 121 | - * Example: | ||
| 122 | - * | ||
| 123 | - * GCDAsyncUdpSocketReceiveFilterBlock filter = ^BOOL (NSData *data, NSData *address, id *context) { | ||
| 124 | - * | ||
| 125 | - * MyProtocolMessage *msg = [MyProtocol parseMessage:data]; | ||
| 126 | - * | ||
| 127 | - * *context = response; | ||
| 128 | - * return (response != nil); | ||
| 129 | - * }; | ||
| 130 | - * [udpSocket setReceiveFilter:filter withQueue:myParsingQueue]; | ||
| 131 | - * | ||
| 132 | -**/ | ||
| 133 | -typedef BOOL (^GCDAsyncUdpSocketReceiveFilterBlock)(NSData *data, NSData *address, id __nullable * __nonnull context); | ||
| 134 | - | ||
| 135 | -/** | ||
| 136 | - * You may optionally set a send filter for the socket. | ||
| 137 | - * A filter can provide several interesting possibilities: | ||
| 138 | - * | ||
| 139 | - * 1. Optional caching of resolved addresses for domain names. | ||
| 140 | - * The cache could later be consulted, resulting in fewer system calls to getaddrinfo. | ||
| 141 | - * | ||
| 142 | - * 2. Reusable modules of code for bandwidth monitoring. | ||
| 143 | - * | ||
| 144 | - * 3. Sometimes traffic shapers are needed to simulate real world environments. | ||
| 145 | - * A filter allows you to write custom code to simulate such environments. | ||
| 146 | - * The ability to code this yourself is especially helpful when your simulated environment | ||
| 147 | - * is more complicated than simple traffic shaping (e.g. simulating a cone port restricted router), | ||
| 148 | - * or the system tools to handle this aren't available (e.g. on a mobile device). | ||
| 149 | - * | ||
| 150 | - * @param data - The packet that was received. | ||
| 151 | - * @param address - The address the data was received from. | ||
| 152 | - * See utilities section for methods to extract info from address. | ||
| 153 | - * @param tag - The tag that was passed in the send method. | ||
| 154 | - * | ||
| 155 | - * @returns - YES if the packet should actually be sent over the socket. | ||
| 156 | - * NO if the packet should be silently dropped (not sent over the socket). | ||
| 157 | - * | ||
| 158 | - * Regardless of the return value, the delegate will be informed that the packet was successfully sent. | ||
| 159 | - * | ||
| 160 | -**/ | ||
| 161 | -typedef BOOL (^GCDAsyncUdpSocketSendFilterBlock)(NSData *data, NSData *address, long tag); | ||
| 162 | - | ||
| 163 | - | ||
| 164 | -@interface GCDAsyncUdpSocket : NSObject | ||
| 165 | - | ||
| 166 | -/** | ||
| 167 | - * GCDAsyncUdpSocket uses the standard delegate paradigm, | ||
| 168 | - * but executes all delegate callbacks on a given delegate dispatch queue. | ||
| 169 | - * This allows for maximum concurrency, while at the same time providing easy thread safety. | ||
| 170 | - * | ||
| 171 | - * You MUST set a delegate AND delegate dispatch queue before attempting to | ||
| 172 | - * use the socket, or you will get an error. | ||
| 173 | - * | ||
| 174 | - * The socket queue is optional. | ||
| 175 | - * If you pass NULL, GCDAsyncSocket will automatically create its own socket queue. | ||
| 176 | - * If you choose to provide a socket queue, the socket queue must not be a concurrent queue, | ||
| 177 | - * then please see the discussion for the method markSocketQueueTargetQueue. | ||
| 178 | - * | ||
| 179 | - * The delegate queue and socket queue can optionally be the same. | ||
| 180 | -**/ | ||
| 181 | -- (instancetype)init; | ||
| 182 | -- (instancetype)initWithSocketQueue:(nullable dispatch_queue_t)sq; | ||
| 183 | -- (instancetype)initWithDelegate:(nullable id <GCDAsyncUdpSocketDelegate>)aDelegate delegateQueue:(nullable dispatch_queue_t)dq; | ||
| 184 | -- (instancetype)initWithDelegate:(nullable id <GCDAsyncUdpSocketDelegate>)aDelegate delegateQueue:(nullable dispatch_queue_t)dq socketQueue:(nullable dispatch_queue_t)sq; | ||
| 185 | - | ||
| 186 | -#pragma mark Configuration | ||
| 187 | - | ||
| 188 | -- (nullable id <GCDAsyncUdpSocketDelegate>)delegate; | ||
| 189 | -- (void)setDelegate:(nullable id <GCDAsyncUdpSocketDelegate>)delegate; | ||
| 190 | -- (void)synchronouslySetDelegate:(nullable id <GCDAsyncUdpSocketDelegate>)delegate; | ||
| 191 | - | ||
| 192 | -- (nullable dispatch_queue_t)delegateQueue; | ||
| 193 | -- (void)setDelegateQueue:(nullable dispatch_queue_t)delegateQueue; | ||
| 194 | -- (void)synchronouslySetDelegateQueue:(nullable dispatch_queue_t)delegateQueue; | ||
| 195 | - | ||
| 196 | -- (void)getDelegate:(id <GCDAsyncUdpSocketDelegate> __nullable * __nullable)delegatePtr delegateQueue:(dispatch_queue_t __nullable * __nullable)delegateQueuePtr; | ||
| 197 | -- (void)setDelegate:(nullable id <GCDAsyncUdpSocketDelegate>)delegate delegateQueue:(nullable dispatch_queue_t)delegateQueue; | ||
| 198 | -- (void)synchronouslySetDelegate:(nullable id <GCDAsyncUdpSocketDelegate>)delegate delegateQueue:(nullable dispatch_queue_t)delegateQueue; | ||
| 199 | - | ||
| 200 | -/** | ||
| 201 | - * By default, both IPv4 and IPv6 are enabled. | ||
| 202 | - * | ||
| 203 | - * This means GCDAsyncUdpSocket automatically supports both protocols, | ||
| 204 | - * and can send to IPv4 or IPv6 addresses, | ||
| 205 | - * as well as receive over IPv4 and IPv6. | ||
| 206 | - * | ||
| 207 | - * For operations that require DNS resolution, GCDAsyncUdpSocket supports both IPv4 and IPv6. | ||
| 208 | - * If a DNS lookup returns only IPv4 results, GCDAsyncUdpSocket will automatically use IPv4. | ||
| 209 | - * If a DNS lookup returns only IPv6 results, GCDAsyncUdpSocket will automatically use IPv6. | ||
| 210 | - * If a DNS lookup returns both IPv4 and IPv6 results, then the protocol used depends on the configured preference. | ||
| 211 | - * If IPv4 is preferred, then IPv4 is used. | ||
| 212 | - * If IPv6 is preferred, then IPv6 is used. | ||
| 213 | - * If neutral, then the first IP version in the resolved array will be used. | ||
| 214 | - * | ||
| 215 | - * Starting with Mac OS X 10.7 Lion and iOS 5, the default IP preference is neutral. | ||
| 216 | - * On prior systems the default IP preference is IPv4. | ||
| 217 | - **/ | ||
| 218 | -- (BOOL)isIPv4Enabled; | ||
| 219 | -- (void)setIPv4Enabled:(BOOL)flag; | ||
| 220 | - | ||
| 221 | -- (BOOL)isIPv6Enabled; | ||
| 222 | -- (void)setIPv6Enabled:(BOOL)flag; | ||
| 223 | - | ||
| 224 | -- (BOOL)isIPv4Preferred; | ||
| 225 | -- (BOOL)isIPv6Preferred; | ||
| 226 | -- (BOOL)isIPVersionNeutral; | ||
| 227 | - | ||
| 228 | -- (void)setPreferIPv4; | ||
| 229 | -- (void)setPreferIPv6; | ||
| 230 | -- (void)setIPVersionNeutral; | ||
| 231 | - | ||
| 232 | -/** | ||
| 233 | - * Gets/Sets the maximum size of the buffer that will be allocated for receive operations. | ||
| 234 | - * The default maximum size is 9216 bytes. | ||
| 235 | - * | ||
| 236 | - * The theoretical maximum size of any IPv4 UDP packet is UINT16_MAX = 65535. | ||
| 237 | - * The theoretical maximum size of any IPv6 UDP packet is UINT32_MAX = 4294967295. | ||
| 238 | - * | ||
| 239 | - * Since the OS/GCD notifies us of the size of each received UDP packet, | ||
| 240 | - * the actual allocated buffer size for each packet is exact. | ||
| 241 | - * And in practice the size of UDP packets is generally much smaller than the max. | ||
| 242 | - * Indeed most protocols will send and receive packets of only a few bytes, | ||
| 243 | - * or will set a limit on the size of packets to prevent fragmentation in the IP layer. | ||
| 244 | - * | ||
| 245 | - * If you set the buffer size too small, the sockets API in the OS will silently discard | ||
| 246 | - * any extra data, and you will not be notified of the error. | ||
| 247 | -**/ | ||
| 248 | -- (uint16_t)maxReceiveIPv4BufferSize; | ||
| 249 | -- (void)setMaxReceiveIPv4BufferSize:(uint16_t)max; | ||
| 250 | - | ||
| 251 | -- (uint32_t)maxReceiveIPv6BufferSize; | ||
| 252 | -- (void)setMaxReceiveIPv6BufferSize:(uint32_t)max; | ||
| 253 | - | ||
| 254 | -/** | ||
| 255 | - * User data allows you to associate arbitrary information with the socket. | ||
| 256 | - * This data is not used internally in any way. | ||
| 257 | -**/ | ||
| 258 | -- (nullable id)userData; | ||
| 259 | -- (void)setUserData:(nullable id)arbitraryUserData; | ||
| 260 | - | ||
| 261 | -#pragma mark Diagnostics | ||
| 262 | - | ||
| 263 | -/** | ||
| 264 | - * Returns the local address info for the socket. | ||
| 265 | - * | ||
| 266 | - * The localAddress method returns a sockaddr structure wrapped in a NSData object. | ||
| 267 | - * The localHost method returns the human readable IP address as a string. | ||
| 268 | - * | ||
| 269 | - * Note: Address info may not be available until after the socket has been binded, connected | ||
| 270 | - * or until after data has been sent. | ||
| 271 | -**/ | ||
| 272 | -- (nullable NSData *)localAddress; | ||
| 273 | -- (nullable NSString *)localHost; | ||
| 274 | -- (uint16_t)localPort; | ||
| 275 | - | ||
| 276 | -- (nullable NSData *)localAddress_IPv4; | ||
| 277 | -- (nullable NSString *)localHost_IPv4; | ||
| 278 | -- (uint16_t)localPort_IPv4; | ||
| 279 | - | ||
| 280 | -- (nullable NSData *)localAddress_IPv6; | ||
| 281 | -- (nullable NSString *)localHost_IPv6; | ||
| 282 | -- (uint16_t)localPort_IPv6; | ||
| 283 | - | ||
| 284 | -/** | ||
| 285 | - * Returns the remote address info for the socket. | ||
| 286 | - * | ||
| 287 | - * The connectedAddress method returns a sockaddr structure wrapped in a NSData object. | ||
| 288 | - * The connectedHost method returns the human readable IP address as a string. | ||
| 289 | - * | ||
| 290 | - * Note: Since UDP is connectionless by design, connected address info | ||
| 291 | - * will not be available unless the socket is explicitly connected to a remote host/port. | ||
| 292 | - * If the socket is not connected, these methods will return nil / 0. | ||
| 293 | -**/ | ||
| 294 | -- (nullable NSData *)connectedAddress; | ||
| 295 | -- (nullable NSString *)connectedHost; | ||
| 296 | -- (uint16_t)connectedPort; | ||
| 297 | - | ||
| 298 | -/** | ||
| 299 | - * Returns whether or not this socket has been connected to a single host. | ||
| 300 | - * By design, UDP is a connectionless protocol, and connecting is not needed. | ||
| 301 | - * If connected, the socket will only be able to send/receive data to/from the connected host. | ||
| 302 | -**/ | ||
| 303 | -- (BOOL)isConnected; | ||
| 304 | - | ||
| 305 | -/** | ||
| 306 | - * Returns whether or not this socket has been closed. | ||
| 307 | - * The only way a socket can be closed is if you explicitly call one of the close methods. | ||
| 308 | -**/ | ||
| 309 | -- (BOOL)isClosed; | ||
| 310 | - | ||
| 311 | -/** | ||
| 312 | - * Returns whether or not this socket is IPv4. | ||
| 313 | - * | ||
| 314 | - * By default this will be true, unless: | ||
| 315 | - * - IPv4 is disabled (via setIPv4Enabled:) | ||
| 316 | - * - The socket is explicitly bound to an IPv6 address | ||
| 317 | - * - The socket is connected to an IPv6 address | ||
| 318 | -**/ | ||
| 319 | -- (BOOL)isIPv4; | ||
| 320 | - | ||
| 321 | -/** | ||
| 322 | - * Returns whether or not this socket is IPv6. | ||
| 323 | - * | ||
| 324 | - * By default this will be true, unless: | ||
| 325 | - * - IPv6 is disabled (via setIPv6Enabled:) | ||
| 326 | - * - The socket is explicitly bound to an IPv4 address | ||
| 327 | - * _ The socket is connected to an IPv4 address | ||
| 328 | - * | ||
| 329 | - * This method will also return false on platforms that do not support IPv6. | ||
| 330 | - * Note: The iPhone does not currently support IPv6. | ||
| 331 | -**/ | ||
| 332 | -- (BOOL)isIPv6; | ||
| 333 | - | ||
| 334 | -#pragma mark Binding | ||
| 335 | - | ||
| 336 | -/** | ||
| 337 | - * Binds the UDP socket to the given port. | ||
| 338 | - * Binding should be done for server sockets that receive data prior to sending it. | ||
| 339 | - * Client sockets can skip binding, | ||
| 340 | - * as the OS will automatically assign the socket an available port when it starts sending data. | ||
| 341 | - * | ||
| 342 | - * You may optionally pass a port number of zero to immediately bind the socket, | ||
| 343 | - * yet still allow the OS to automatically assign an available port. | ||
| 344 | - * | ||
| 345 | - * You cannot bind a socket after its been connected. | ||
| 346 | - * You can only bind a socket once. | ||
| 347 | - * You can still connect a socket (if desired) after binding. | ||
| 348 | - * | ||
| 349 | - * On success, returns YES. | ||
| 350 | - * Otherwise returns NO, and sets errPtr. If you don't care about the error, you can pass NULL for errPtr. | ||
| 351 | -**/ | ||
| 352 | -- (BOOL)bindToPort:(uint16_t)port error:(NSError **)errPtr; | ||
| 353 | - | ||
| 354 | -/** | ||
| 355 | - * Binds the UDP socket to the given port and optional interface. | ||
| 356 | - * Binding should be done for server sockets that receive data prior to sending it. | ||
| 357 | - * Client sockets can skip binding, | ||
| 358 | - * as the OS will automatically assign the socket an available port when it starts sending data. | ||
| 359 | - * | ||
| 360 | - * You may optionally pass a port number of zero to immediately bind the socket, | ||
| 361 | - * yet still allow the OS to automatically assign an available port. | ||
| 362 | - * | ||
| 363 | - * The interface may be a name (e.g. "en1" or "lo0") or the corresponding IP address (e.g. "192.168.4.35"). | ||
| 364 | - * You may also use the special strings "localhost" or "loopback" to specify that | ||
| 365 | - * the socket only accept packets from the local machine. | ||
| 366 | - * | ||
| 367 | - * You cannot bind a socket after its been connected. | ||
| 368 | - * You can only bind a socket once. | ||
| 369 | - * You can still connect a socket (if desired) after binding. | ||
| 370 | - * | ||
| 371 | - * On success, returns YES. | ||
| 372 | - * Otherwise returns NO, and sets errPtr. If you don't care about the error, you can pass NULL for errPtr. | ||
| 373 | -**/ | ||
| 374 | -- (BOOL)bindToPort:(uint16_t)port interface:(nullable NSString *)interface error:(NSError **)errPtr; | ||
| 375 | - | ||
| 376 | -/** | ||
| 377 | - * Binds the UDP socket to the given address, specified as a sockaddr structure wrapped in a NSData object. | ||
| 378 | - * | ||
| 379 | - * If you have an existing struct sockaddr you can convert it to a NSData object like so: | ||
| 380 | - * struct sockaddr sa -> NSData *dsa = [NSData dataWithBytes:&remoteAddr length:remoteAddr.sa_len]; | ||
| 381 | - * struct sockaddr *sa -> NSData *dsa = [NSData dataWithBytes:remoteAddr length:remoteAddr->sa_len]; | ||
| 382 | - * | ||
| 383 | - * Binding should be done for server sockets that receive data prior to sending it. | ||
| 384 | - * Client sockets can skip binding, | ||
| 385 | - * as the OS will automatically assign the socket an available port when it starts sending data. | ||
| 386 | - * | ||
| 387 | - * You cannot bind a socket after its been connected. | ||
| 388 | - * You can only bind a socket once. | ||
| 389 | - * You can still connect a socket (if desired) after binding. | ||
| 390 | - * | ||
| 391 | - * On success, returns YES. | ||
| 392 | - * Otherwise returns NO, and sets errPtr. If you don't care about the error, you can pass NULL for errPtr. | ||
| 393 | -**/ | ||
| 394 | -- (BOOL)bindToAddress:(NSData *)localAddr error:(NSError **)errPtr; | ||
| 395 | - | ||
| 396 | -#pragma mark Connecting | ||
| 397 | - | ||
| 398 | -/** | ||
| 399 | - * Connects the UDP socket to the given host and port. | ||
| 400 | - * By design, UDP is a connectionless protocol, and connecting is not needed. | ||
| 401 | - * | ||
| 402 | - * Choosing to connect to a specific host/port has the following effect: | ||
| 403 | - * - You will only be able to send data to the connected host/port. | ||
| 404 | - * - You will only be able to receive data from the connected host/port. | ||
| 405 | - * - You will receive ICMP messages that come from the connected host/port, such as "connection refused". | ||
| 406 | - * | ||
| 407 | - * The actual process of connecting a UDP socket does not result in any communication on the socket. | ||
| 408 | - * It simply changes the internal state of the socket. | ||
| 409 | - * | ||
| 410 | - * You cannot bind a socket after it has been connected. | ||
| 411 | - * You can only connect a socket once. | ||
| 412 | - * | ||
| 413 | - * The host may be a domain name (e.g. "deusty.com") or an IP address string (e.g. "192.168.0.2"). | ||
| 414 | - * | ||
| 415 | - * This method is asynchronous as it requires a DNS lookup to resolve the given host name. | ||
| 416 | - * If an obvious error is detected, this method immediately returns NO and sets errPtr. | ||
| 417 | - * If you don't care about the error, you can pass nil for errPtr. | ||
| 418 | - * Otherwise, this method returns YES and begins the asynchronous connection process. | ||
| 419 | - * The result of the asynchronous connection process will be reported via the delegate methods. | ||
| 420 | - **/ | ||
| 421 | -- (BOOL)connectToHost:(NSString *)host onPort:(uint16_t)port error:(NSError **)errPtr; | ||
| 422 | - | ||
| 423 | -/** | ||
| 424 | - * Connects the UDP socket to the given address, specified as a sockaddr structure wrapped in a NSData object. | ||
| 425 | - * | ||
| 426 | - * If you have an existing struct sockaddr you can convert it to a NSData object like so: | ||
| 427 | - * struct sockaddr sa -> NSData *dsa = [NSData dataWithBytes:&remoteAddr length:remoteAddr.sa_len]; | ||
| 428 | - * struct sockaddr *sa -> NSData *dsa = [NSData dataWithBytes:remoteAddr length:remoteAddr->sa_len]; | ||
| 429 | - * | ||
| 430 | - * By design, UDP is a connectionless protocol, and connecting is not needed. | ||
| 431 | - * | ||
| 432 | - * Choosing to connect to a specific address has the following effect: | ||
| 433 | - * - You will only be able to send data to the connected address. | ||
| 434 | - * - You will only be able to receive data from the connected address. | ||
| 435 | - * - You will receive ICMP messages that come from the connected address, such as "connection refused". | ||
| 436 | - * | ||
| 437 | - * Connecting a UDP socket does not result in any communication on the socket. | ||
| 438 | - * It simply changes the internal state of the socket. | ||
| 439 | - * | ||
| 440 | - * You cannot bind a socket after its been connected. | ||
| 441 | - * You can only connect a socket once. | ||
| 442 | - * | ||
| 443 | - * On success, returns YES. | ||
| 444 | - * Otherwise returns NO, and sets errPtr. If you don't care about the error, you can pass nil for errPtr. | ||
| 445 | - * | ||
| 446 | - * Note: Unlike the connectToHost:onPort:error: method, this method does not require a DNS lookup. | ||
| 447 | - * Thus when this method returns, the connection has either failed or fully completed. | ||
| 448 | - * In other words, this method is synchronous, unlike the asynchronous connectToHost::: method. | ||
| 449 | - * However, for compatibility and simplification of delegate code, if this method returns YES | ||
| 450 | - * then the corresponding delegate method (udpSocket:didConnectToHost:port:) is still invoked. | ||
| 451 | -**/ | ||
| 452 | -- (BOOL)connectToAddress:(NSData *)remoteAddr error:(NSError **)errPtr; | ||
| 453 | - | ||
| 454 | -#pragma mark Multicast | ||
| 455 | - | ||
| 456 | -/** | ||
| 457 | - * Join multicast group. | ||
| 458 | - * Group should be an IP address (eg @"225.228.0.1"). | ||
| 459 | - * | ||
| 460 | - * On success, returns YES. | ||
| 461 | - * Otherwise returns NO, and sets errPtr. If you don't care about the error, you can pass nil for errPtr. | ||
| 462 | -**/ | ||
| 463 | -- (BOOL)joinMulticastGroup:(NSString *)group error:(NSError **)errPtr; | ||
| 464 | - | ||
| 465 | -/** | ||
| 466 | - * Join multicast group. | ||
| 467 | - * Group should be an IP address (eg @"225.228.0.1"). | ||
| 468 | - * The interface may be a name (e.g. "en1" or "lo0") or the corresponding IP address (e.g. "192.168.4.35"). | ||
| 469 | - * | ||
| 470 | - * On success, returns YES. | ||
| 471 | - * Otherwise returns NO, and sets errPtr. If you don't care about the error, you can pass nil for errPtr. | ||
| 472 | -**/ | ||
| 473 | -- (BOOL)joinMulticastGroup:(NSString *)group onInterface:(nullable NSString *)interface error:(NSError **)errPtr; | ||
| 474 | - | ||
| 475 | -- (BOOL)leaveMulticastGroup:(NSString *)group error:(NSError **)errPtr; | ||
| 476 | -- (BOOL)leaveMulticastGroup:(NSString *)group onInterface:(nullable NSString *)interface error:(NSError **)errPtr; | ||
| 477 | - | ||
| 478 | -#pragma mark Reuse Port | ||
| 479 | - | ||
| 480 | -/** | ||
| 481 | - * By default, only one socket can be bound to a given IP address + port at a time. | ||
| 482 | - * To enable multiple processes to simultaneously bind to the same address+port, | ||
| 483 | - * you need to enable this functionality in the socket. All processes that wish to | ||
| 484 | - * use the address+port simultaneously must all enable reuse port on the socket | ||
| 485 | - * bound to that port. | ||
| 486 | - **/ | ||
| 487 | -- (BOOL)enableReusePort:(BOOL)flag error:(NSError **)errPtr; | ||
| 488 | - | ||
| 489 | -#pragma mark Broadcast | ||
| 490 | - | ||
| 491 | -/** | ||
| 492 | - * By default, the underlying socket in the OS will not allow you to send broadcast messages. | ||
| 493 | - * In order to send broadcast messages, you need to enable this functionality in the socket. | ||
| 494 | - * | ||
| 495 | - * A broadcast is a UDP message to addresses like "192.168.255.255" or "255.255.255.255" that is | ||
| 496 | - * delivered to every host on the network. | ||
| 497 | - * The reason this is generally disabled by default (by the OS) is to prevent | ||
| 498 | - * accidental broadcast messages from flooding the network. | ||
| 499 | -**/ | ||
| 500 | -- (BOOL)enableBroadcast:(BOOL)flag error:(NSError **)errPtr; | ||
| 501 | - | ||
| 502 | -#pragma mark Sending | ||
| 503 | - | ||
| 504 | -/** | ||
| 505 | - * Asynchronously sends the given data, with the given timeout and tag. | ||
| 506 | - * | ||
| 507 | - * This method may only be used with a connected socket. | ||
| 508 | - * Recall that connecting is optional for a UDP socket. | ||
| 509 | - * For connected sockets, data can only be sent to the connected address. | ||
| 510 | - * For non-connected sockets, the remote destination is specified for each packet. | ||
| 511 | - * For more information about optionally connecting udp sockets, see the documentation for the connect methods above. | ||
| 512 | - * | ||
| 513 | - * @param data | ||
| 514 | - * The data to send. | ||
| 515 | - * If data is nil or zero-length, this method does nothing. | ||
| 516 | - * If passing NSMutableData, please read the thread-safety notice below. | ||
| 517 | - * | ||
| 518 | - * @param timeout | ||
| 519 | - * The timeout for the send opeartion. | ||
| 520 | - * If the timeout value is negative, the send operation will not use a timeout. | ||
| 521 | - * | ||
| 522 | - * @param tag | ||
| 523 | - * The tag is for your convenience. | ||
| 524 | - * It is not sent or received over the socket in any manner what-so-ever. | ||
| 525 | - * It is reported back as a parameter in the udpSocket:didSendDataWithTag: | ||
| 526 | - * or udpSocket:didNotSendDataWithTag:dueToError: methods. | ||
| 527 | - * You can use it as an array index, state id, type constant, etc. | ||
| 528 | - * | ||
| 529 | - * | ||
| 530 | - * Thread-Safety Note: | ||
| 531 | - * If the given data parameter is mutable (NSMutableData) then you MUST NOT alter the data while | ||
| 532 | - * the socket is sending it. In other words, it's not safe to alter the data until after the delegate method | ||
| 533 | - * udpSocket:didSendDataWithTag: or udpSocket:didNotSendDataWithTag:dueToError: is invoked signifying | ||
| 534 | - * that this particular send operation has completed. | ||
| 535 | - * This is due to the fact that GCDAsyncUdpSocket does NOT copy the data. | ||
| 536 | - * It simply retains it for performance reasons. | ||
| 537 | - * Often times, if NSMutableData is passed, it is because a request/response was built up in memory. | ||
| 538 | - * Copying this data adds an unwanted/unneeded overhead. | ||
| 539 | - * If you need to write data from an immutable buffer, and you need to alter the buffer before the socket | ||
| 540 | - * completes sending the bytes (which is NOT immediately after this method returns, but rather at a later time | ||
| 541 | - * when the delegate method notifies you), then you should first copy the bytes, and pass the copy to this method. | ||
| 542 | -**/ | ||
| 543 | -- (void)sendData:(NSData *)data withTimeout:(NSTimeInterval)timeout tag:(long)tag; | ||
| 544 | - | ||
| 545 | -/** | ||
| 546 | - * Asynchronously sends the given data, with the given timeout and tag, to the given host and port. | ||
| 547 | - * | ||
| 548 | - * This method cannot be used with a connected socket. | ||
| 549 | - * Recall that connecting is optional for a UDP socket. | ||
| 550 | - * For connected sockets, data can only be sent to the connected address. | ||
| 551 | - * For non-connected sockets, the remote destination is specified for each packet. | ||
| 552 | - * For more information about optionally connecting udp sockets, see the documentation for the connect methods above. | ||
| 553 | - * | ||
| 554 | - * @param data | ||
| 555 | - * The data to send. | ||
| 556 | - * If data is nil or zero-length, this method does nothing. | ||
| 557 | - * If passing NSMutableData, please read the thread-safety notice below. | ||
| 558 | - * | ||
| 559 | - * @param host | ||
| 560 | - * The destination to send the udp packet to. | ||
| 561 | - * May be specified as a domain name (e.g. "deusty.com") or an IP address string (e.g. "192.168.0.2"). | ||
| 562 | - * You may also use the convenience strings of "loopback" or "localhost". | ||
| 563 | - * | ||
| 564 | - * @param port | ||
| 565 | - * The port of the host to send to. | ||
| 566 | - * | ||
| 567 | - * @param timeout | ||
| 568 | - * The timeout for the send opeartion. | ||
| 569 | - * If the timeout value is negative, the send operation will not use a timeout. | ||
| 570 | - * | ||
| 571 | - * @param tag | ||
| 572 | - * The tag is for your convenience. | ||
| 573 | - * It is not sent or received over the socket in any manner what-so-ever. | ||
| 574 | - * It is reported back as a parameter in the udpSocket:didSendDataWithTag: | ||
| 575 | - * or udpSocket:didNotSendDataWithTag:dueToError: methods. | ||
| 576 | - * You can use it as an array index, state id, type constant, etc. | ||
| 577 | - * | ||
| 578 | - * | ||
| 579 | - * Thread-Safety Note: | ||
| 580 | - * If the given data parameter is mutable (NSMutableData) then you MUST NOT alter the data while | ||
| 581 | - * the socket is sending it. In other words, it's not safe to alter the data until after the delegate method | ||
| 582 | - * udpSocket:didSendDataWithTag: or udpSocket:didNotSendDataWithTag:dueToError: is invoked signifying | ||
| 583 | - * that this particular send operation has completed. | ||
| 584 | - * This is due to the fact that GCDAsyncUdpSocket does NOT copy the data. | ||
| 585 | - * It simply retains it for performance reasons. | ||
| 586 | - * Often times, if NSMutableData is passed, it is because a request/response was built up in memory. | ||
| 587 | - * Copying this data adds an unwanted/unneeded overhead. | ||
| 588 | - * If you need to write data from an immutable buffer, and you need to alter the buffer before the socket | ||
| 589 | - * completes sending the bytes (which is NOT immediately after this method returns, but rather at a later time | ||
| 590 | - * when the delegate method notifies you), then you should first copy the bytes, and pass the copy to this method. | ||
| 591 | -**/ | ||
| 592 | -- (void)sendData:(NSData *)data | ||
| 593 | - toHost:(NSString *)host | ||
| 594 | - port:(uint16_t)port | ||
| 595 | - withTimeout:(NSTimeInterval)timeout | ||
| 596 | - tag:(long)tag; | ||
| 597 | - | ||
| 598 | -/** | ||
| 599 | - * Asynchronously sends the given data, with the given timeout and tag, to the given address. | ||
| 600 | - * | ||
| 601 | - * This method cannot be used with a connected socket. | ||
| 602 | - * Recall that connecting is optional for a UDP socket. | ||
| 603 | - * For connected sockets, data can only be sent to the connected address. | ||
| 604 | - * For non-connected sockets, the remote destination is specified for each packet. | ||
| 605 | - * For more information about optionally connecting udp sockets, see the documentation for the connect methods above. | ||
| 606 | - * | ||
| 607 | - * @param data | ||
| 608 | - * The data to send. | ||
| 609 | - * If data is nil or zero-length, this method does nothing. | ||
| 610 | - * If passing NSMutableData, please read the thread-safety notice below. | ||
| 611 | - * | ||
| 612 | - * @param remoteAddr | ||
| 613 | - * The address to send the data to (specified as a sockaddr structure wrapped in a NSData object). | ||
| 614 | - * | ||
| 615 | - * @param timeout | ||
| 616 | - * The timeout for the send opeartion. | ||
| 617 | - * If the timeout value is negative, the send operation will not use a timeout. | ||
| 618 | - * | ||
| 619 | - * @param tag | ||
| 620 | - * The tag is for your convenience. | ||
| 621 | - * It is not sent or received over the socket in any manner what-so-ever. | ||
| 622 | - * It is reported back as a parameter in the udpSocket:didSendDataWithTag: | ||
| 623 | - * or udpSocket:didNotSendDataWithTag:dueToError: methods. | ||
| 624 | - * You can use it as an array index, state id, type constant, etc. | ||
| 625 | - * | ||
| 626 | - * | ||
| 627 | - * Thread-Safety Note: | ||
| 628 | - * If the given data parameter is mutable (NSMutableData) then you MUST NOT alter the data while | ||
| 629 | - * the socket is sending it. In other words, it's not safe to alter the data until after the delegate method | ||
| 630 | - * udpSocket:didSendDataWithTag: or udpSocket:didNotSendDataWithTag:dueToError: is invoked signifying | ||
| 631 | - * that this particular send operation has completed. | ||
| 632 | - * This is due to the fact that GCDAsyncUdpSocket does NOT copy the data. | ||
| 633 | - * It simply retains it for performance reasons. | ||
| 634 | - * Often times, if NSMutableData is passed, it is because a request/response was built up in memory. | ||
| 635 | - * Copying this data adds an unwanted/unneeded overhead. | ||
| 636 | - * If you need to write data from an immutable buffer, and you need to alter the buffer before the socket | ||
| 637 | - * completes sending the bytes (which is NOT immediately after this method returns, but rather at a later time | ||
| 638 | - * when the delegate method notifies you), then you should first copy the bytes, and pass the copy to this method. | ||
| 639 | -**/ | ||
| 640 | -- (void)sendData:(NSData *)data toAddress:(NSData *)remoteAddr withTimeout:(NSTimeInterval)timeout tag:(long)tag; | ||
| 641 | - | ||
| 642 | -/** | ||
| 643 | - * You may optionally set a send filter for the socket. | ||
| 644 | - * A filter can provide several interesting possibilities: | ||
| 645 | - * | ||
| 646 | - * 1. Optional caching of resolved addresses for domain names. | ||
| 647 | - * The cache could later be consulted, resulting in fewer system calls to getaddrinfo. | ||
| 648 | - * | ||
| 649 | - * 2. Reusable modules of code for bandwidth monitoring. | ||
| 650 | - * | ||
| 651 | - * 3. Sometimes traffic shapers are needed to simulate real world environments. | ||
| 652 | - * A filter allows you to write custom code to simulate such environments. | ||
| 653 | - * The ability to code this yourself is especially helpful when your simulated environment | ||
| 654 | - * is more complicated than simple traffic shaping (e.g. simulating a cone port restricted router), | ||
| 655 | - * or the system tools to handle this aren't available (e.g. on a mobile device). | ||
| 656 | - * | ||
| 657 | - * For more information about GCDAsyncUdpSocketSendFilterBlock, see the documentation for its typedef. | ||
| 658 | - * To remove a previously set filter, invoke this method and pass a nil filterBlock and NULL filterQueue. | ||
| 659 | - * | ||
| 660 | - * Note: This method invokes setSendFilter:withQueue:isAsynchronous: (documented below), | ||
| 661 | - * passing YES for the isAsynchronous parameter. | ||
| 662 | -**/ | ||
| 663 | -- (void)setSendFilter:(nullable GCDAsyncUdpSocketSendFilterBlock)filterBlock withQueue:(nullable dispatch_queue_t)filterQueue; | ||
| 664 | - | ||
| 665 | -/** | ||
| 666 | - * The receive filter can be run via dispatch_async or dispatch_sync. | ||
| 667 | - * Most typical situations call for asynchronous operation. | ||
| 668 | - * | ||
| 669 | - * However, there are a few situations in which synchronous operation is preferred. | ||
| 670 | - * Such is the case when the filter is extremely minimal and fast. | ||
| 671 | - * This is because dispatch_sync is faster than dispatch_async. | ||
| 672 | - * | ||
| 673 | - * If you choose synchronous operation, be aware of possible deadlock conditions. | ||
| 674 | - * Since the socket queue is executing your block via dispatch_sync, | ||
| 675 | - * then you cannot perform any tasks which may invoke dispatch_sync on the socket queue. | ||
| 676 | - * For example, you can't query properties on the socket. | ||
| 677 | -**/ | ||
| 678 | -- (void)setSendFilter:(nullable GCDAsyncUdpSocketSendFilterBlock)filterBlock | ||
| 679 | - withQueue:(nullable dispatch_queue_t)filterQueue | ||
| 680 | - isAsynchronous:(BOOL)isAsynchronous; | ||
| 681 | - | ||
| 682 | -#pragma mark Receiving | ||
| 683 | - | ||
| 684 | -/** | ||
| 685 | - * There are two modes of operation for receiving packets: one-at-a-time & continuous. | ||
| 686 | - * | ||
| 687 | - * In one-at-a-time mode, you call receiveOnce everytime your delegate is ready to process an incoming udp packet. | ||
| 688 | - * Receiving packets one-at-a-time may be better suited for implementing certain state machine code, | ||
| 689 | - * where your state machine may not always be ready to process incoming packets. | ||
| 690 | - * | ||
| 691 | - * In continuous mode, the delegate is invoked immediately everytime incoming udp packets are received. | ||
| 692 | - * Receiving packets continuously is better suited to real-time streaming applications. | ||
| 693 | - * | ||
| 694 | - * You may switch back and forth between one-at-a-time mode and continuous mode. | ||
| 695 | - * If the socket is currently in continuous mode, calling this method will switch it to one-at-a-time mode. | ||
| 696 | - * | ||
| 697 | - * When a packet is received (and not filtered by the optional receive filter), | ||
| 698 | - * the delegate method (udpSocket:didReceiveData:fromAddress:withFilterContext:) is invoked. | ||
| 699 | - * | ||
| 700 | - * If the socket is able to begin receiving packets, this method returns YES. | ||
| 701 | - * Otherwise it returns NO, and sets the errPtr with appropriate error information. | ||
| 702 | - * | ||
| 703 | - * An example error: | ||
| 704 | - * You created a udp socket to act as a server, and immediately called receive. | ||
| 705 | - * You forgot to first bind the socket to a port number, and received a error with a message like: | ||
| 706 | - * "Must bind socket before you can receive data." | ||
| 707 | -**/ | ||
| 708 | -- (BOOL)receiveOnce:(NSError **)errPtr; | ||
| 709 | - | ||
| 710 | -/** | ||
| 711 | - * There are two modes of operation for receiving packets: one-at-a-time & continuous. | ||
| 712 | - * | ||
| 713 | - * In one-at-a-time mode, you call receiveOnce everytime your delegate is ready to process an incoming udp packet. | ||
| 714 | - * Receiving packets one-at-a-time may be better suited for implementing certain state machine code, | ||
| 715 | - * where your state machine may not always be ready to process incoming packets. | ||
| 716 | - * | ||
| 717 | - * In continuous mode, the delegate is invoked immediately everytime incoming udp packets are received. | ||
| 718 | - * Receiving packets continuously is better suited to real-time streaming applications. | ||
| 719 | - * | ||
| 720 | - * You may switch back and forth between one-at-a-time mode and continuous mode. | ||
| 721 | - * If the socket is currently in one-at-a-time mode, calling this method will switch it to continuous mode. | ||
| 722 | - * | ||
| 723 | - * For every received packet (not filtered by the optional receive filter), | ||
| 724 | - * the delegate method (udpSocket:didReceiveData:fromAddress:withFilterContext:) is invoked. | ||
| 725 | - * | ||
| 726 | - * If the socket is able to begin receiving packets, this method returns YES. | ||
| 727 | - * Otherwise it returns NO, and sets the errPtr with appropriate error information. | ||
| 728 | - * | ||
| 729 | - * An example error: | ||
| 730 | - * You created a udp socket to act as a server, and immediately called receive. | ||
| 731 | - * You forgot to first bind the socket to a port number, and received a error with a message like: | ||
| 732 | - * "Must bind socket before you can receive data." | ||
| 733 | -**/ | ||
| 734 | -- (BOOL)beginReceiving:(NSError **)errPtr; | ||
| 735 | - | ||
| 736 | -/** | ||
| 737 | - * If the socket is currently receiving (beginReceiving has been called), this method pauses the receiving. | ||
| 738 | - * That is, it won't read any more packets from the underlying OS socket until beginReceiving is called again. | ||
| 739 | - * | ||
| 740 | - * Important Note: | ||
| 741 | - * GCDAsyncUdpSocket may be running in parallel with your code. | ||
| 742 | - * That is, your delegate is likely running on a separate thread/dispatch_queue. | ||
| 743 | - * When you invoke this method, GCDAsyncUdpSocket may have already dispatched delegate methods to be invoked. | ||
| 744 | - * Thus, if those delegate methods have already been dispatch_async'd, | ||
| 745 | - * your didReceive delegate method may still be invoked after this method has been called. | ||
| 746 | - * You should be aware of this, and program defensively. | ||
| 747 | -**/ | ||
| 748 | -- (void)pauseReceiving; | ||
| 749 | - | ||
| 750 | -/** | ||
| 751 | - * You may optionally set a receive filter for the socket. | ||
| 752 | - * This receive filter may be set to run in its own queue (independent of delegate queue). | ||
| 753 | - * | ||
| 754 | - * A filter can provide several useful features. | ||
| 755 | - * | ||
| 756 | - * 1. Many times udp packets need to be parsed. | ||
| 757 | - * Since the filter can run in its own independent queue, you can parallelize this parsing quite easily. | ||
| 758 | - * The end result is a parallel socket io, datagram parsing, and packet processing. | ||
| 759 | - * | ||
| 760 | - * 2. Many times udp packets are discarded because they are duplicate/unneeded/unsolicited. | ||
| 761 | - * The filter can prevent such packets from arriving at the delegate. | ||
| 762 | - * And because the filter can run in its own independent queue, this doesn't slow down the delegate. | ||
| 763 | - * | ||
| 764 | - * - Since the udp protocol does not guarantee delivery, udp packets may be lost. | ||
| 765 | - * Many protocols built atop udp thus provide various resend/re-request algorithms. | ||
| 766 | - * This sometimes results in duplicate packets arriving. | ||
| 767 | - * A filter may allow you to architect the duplicate detection code to run in parallel to normal processing. | ||
| 768 | - * | ||
| 769 | - * - Since the udp socket may be connectionless, its possible for unsolicited packets to arrive. | ||
| 770 | - * Such packets need to be ignored. | ||
| 771 | - * | ||
| 772 | - * 3. Sometimes traffic shapers are needed to simulate real world environments. | ||
| 773 | - * A filter allows you to write custom code to simulate such environments. | ||
| 774 | - * The ability to code this yourself is especially helpful when your simulated environment | ||
| 775 | - * is more complicated than simple traffic shaping (e.g. simulating a cone port restricted router), | ||
| 776 | - * or the system tools to handle this aren't available (e.g. on a mobile device). | ||
| 777 | - * | ||
| 778 | - * Example: | ||
| 779 | - * | ||
| 780 | - * GCDAsyncUdpSocketReceiveFilterBlock filter = ^BOOL (NSData *data, NSData *address, id *context) { | ||
| 781 | - * | ||
| 782 | - * MyProtocolMessage *msg = [MyProtocol parseMessage:data]; | ||
| 783 | - * | ||
| 784 | - * *context = response; | ||
| 785 | - * return (response != nil); | ||
| 786 | - * }; | ||
| 787 | - * [udpSocket setReceiveFilter:filter withQueue:myParsingQueue]; | ||
| 788 | - * | ||
| 789 | - * For more information about GCDAsyncUdpSocketReceiveFilterBlock, see the documentation for its typedef. | ||
| 790 | - * To remove a previously set filter, invoke this method and pass a nil filterBlock and NULL filterQueue. | ||
| 791 | - * | ||
| 792 | - * Note: This method invokes setReceiveFilter:withQueue:isAsynchronous: (documented below), | ||
| 793 | - * passing YES for the isAsynchronous parameter. | ||
| 794 | -**/ | ||
| 795 | -- (void)setReceiveFilter:(nullable GCDAsyncUdpSocketReceiveFilterBlock)filterBlock withQueue:(nullable dispatch_queue_t)filterQueue; | ||
| 796 | - | ||
| 797 | -/** | ||
| 798 | - * The receive filter can be run via dispatch_async or dispatch_sync. | ||
| 799 | - * Most typical situations call for asynchronous operation. | ||
| 800 | - * | ||
| 801 | - * However, there are a few situations in which synchronous operation is preferred. | ||
| 802 | - * Such is the case when the filter is extremely minimal and fast. | ||
| 803 | - * This is because dispatch_sync is faster than dispatch_async. | ||
| 804 | - * | ||
| 805 | - * If you choose synchronous operation, be aware of possible deadlock conditions. | ||
| 806 | - * Since the socket queue is executing your block via dispatch_sync, | ||
| 807 | - * then you cannot perform any tasks which may invoke dispatch_sync on the socket queue. | ||
| 808 | - * For example, you can't query properties on the socket. | ||
| 809 | -**/ | ||
| 810 | -- (void)setReceiveFilter:(nullable GCDAsyncUdpSocketReceiveFilterBlock)filterBlock | ||
| 811 | - withQueue:(nullable dispatch_queue_t)filterQueue | ||
| 812 | - isAsynchronous:(BOOL)isAsynchronous; | ||
| 813 | - | ||
| 814 | -#pragma mark Closing | ||
| 815 | - | ||
| 816 | -/** | ||
| 817 | - * Immediately closes the underlying socket. | ||
| 818 | - * Any pending send operations are discarded. | ||
| 819 | - * | ||
| 820 | - * The GCDAsyncUdpSocket instance may optionally be used again. | ||
| 821 | - * (it will setup/configure/use another unnderlying BSD socket). | ||
| 822 | -**/ | ||
| 823 | -- (void)close; | ||
| 824 | - | ||
| 825 | -/** | ||
| 826 | - * Closes the underlying socket after all pending send operations have been sent. | ||
| 827 | - * | ||
| 828 | - * The GCDAsyncUdpSocket instance may optionally be used again. | ||
| 829 | - * (it will setup/configure/use another unnderlying BSD socket). | ||
| 830 | -**/ | ||
| 831 | -- (void)closeAfterSending; | ||
| 832 | - | ||
| 833 | -#pragma mark Advanced | ||
| 834 | -/** | ||
| 835 | - * GCDAsyncSocket maintains thread safety by using an internal serial dispatch_queue. | ||
| 836 | - * In most cases, the instance creates this queue itself. | ||
| 837 | - * However, to allow for maximum flexibility, the internal queue may be passed in the init method. | ||
| 838 | - * This allows for some advanced options such as controlling socket priority via target queues. | ||
| 839 | - * However, when one begins to use target queues like this, they open the door to some specific deadlock issues. | ||
| 840 | - * | ||
| 841 | - * For example, imagine there are 2 queues: | ||
| 842 | - * dispatch_queue_t socketQueue; | ||
| 843 | - * dispatch_queue_t socketTargetQueue; | ||
| 844 | - * | ||
| 845 | - * If you do this (pseudo-code): | ||
| 846 | - * socketQueue.targetQueue = socketTargetQueue; | ||
| 847 | - * | ||
| 848 | - * Then all socketQueue operations will actually get run on the given socketTargetQueue. | ||
| 849 | - * This is fine and works great in most situations. | ||
| 850 | - * But if you run code directly from within the socketTargetQueue that accesses the socket, | ||
| 851 | - * you could potentially get deadlock. Imagine the following code: | ||
| 852 | - * | ||
| 853 | - * - (BOOL)socketHasSomething | ||
| 854 | - * { | ||
| 855 | - * __block BOOL result = NO; | ||
| 856 | - * dispatch_block_t block = ^{ | ||
| 857 | - * result = [self someInternalMethodToBeRunOnlyOnSocketQueue]; | ||
| 858 | - * } | ||
| 859 | - * if (is_executing_on_queue(socketQueue)) | ||
| 860 | - * block(); | ||
| 861 | - * else | ||
| 862 | - * dispatch_sync(socketQueue, block); | ||
| 863 | - * | ||
| 864 | - * return result; | ||
| 865 | - * } | ||
| 866 | - * | ||
| 867 | - * What happens if you call this method from the socketTargetQueue? The result is deadlock. | ||
| 868 | - * This is because the GCD API offers no mechanism to discover a queue's targetQueue. | ||
| 869 | - * Thus we have no idea if our socketQueue is configured with a targetQueue. | ||
| 870 | - * If we had this information, we could easily avoid deadlock. | ||
| 871 | - * But, since these API's are missing or unfeasible, you'll have to explicitly set it. | ||
| 872 | - * | ||
| 873 | - * IF you pass a socketQueue via the init method, | ||
| 874 | - * AND you've configured the passed socketQueue with a targetQueue, | ||
| 875 | - * THEN you should pass the end queue in the target hierarchy. | ||
| 876 | - * | ||
| 877 | - * For example, consider the following queue hierarchy: | ||
| 878 | - * socketQueue -> ipQueue -> moduleQueue | ||
| 879 | - * | ||
| 880 | - * This example demonstrates priority shaping within some server. | ||
| 881 | - * All incoming client connections from the same IP address are executed on the same target queue. | ||
| 882 | - * And all connections for a particular module are executed on the same target queue. | ||
| 883 | - * Thus, the priority of all networking for the entire module can be changed on the fly. | ||
| 884 | - * Additionally, networking traffic from a single IP cannot monopolize the module. | ||
| 885 | - * | ||
| 886 | - * Here's how you would accomplish something like that: | ||
| 887 | - * - (dispatch_queue_t)newSocketQueueForConnectionFromAddress:(NSData *)address onSocket:(GCDAsyncSocket *)sock | ||
| 888 | - * { | ||
| 889 | - * dispatch_queue_t socketQueue = dispatch_queue_create("", NULL); | ||
| 890 | - * dispatch_queue_t ipQueue = [self ipQueueForAddress:address]; | ||
| 891 | - * | ||
| 892 | - * dispatch_set_target_queue(socketQueue, ipQueue); | ||
| 893 | - * dispatch_set_target_queue(iqQueue, moduleQueue); | ||
| 894 | - * | ||
| 895 | - * return socketQueue; | ||
| 896 | - * } | ||
| 897 | - * - (void)socket:(GCDAsyncSocket *)sock didAcceptNewSocket:(GCDAsyncSocket *)newSocket | ||
| 898 | - * { | ||
| 899 | - * [clientConnections addObject:newSocket]; | ||
| 900 | - * [newSocket markSocketQueueTargetQueue:moduleQueue]; | ||
| 901 | - * } | ||
| 902 | - * | ||
| 903 | - * Note: This workaround is ONLY needed if you intend to execute code directly on the ipQueue or moduleQueue. | ||
| 904 | - * This is often NOT the case, as such queues are used solely for execution shaping. | ||
| 905 | - **/ | ||
| 906 | -- (void)markSocketQueueTargetQueue:(dispatch_queue_t)socketQueuesPreConfiguredTargetQueue; | ||
| 907 | -- (void)unmarkSocketQueueTargetQueue:(dispatch_queue_t)socketQueuesPreviouslyConfiguredTargetQueue; | ||
| 908 | - | ||
| 909 | -/** | ||
| 910 | - * It's not thread-safe to access certain variables from outside the socket's internal queue. | ||
| 911 | - * | ||
| 912 | - * For example, the socket file descriptor. | ||
| 913 | - * File descriptors are simply integers which reference an index in the per-process file table. | ||
| 914 | - * However, when one requests a new file descriptor (by opening a file or socket), | ||
| 915 | - * the file descriptor returned is guaranteed to be the lowest numbered unused descriptor. | ||
| 916 | - * So if we're not careful, the following could be possible: | ||
| 917 | - * | ||
| 918 | - * - Thread A invokes a method which returns the socket's file descriptor. | ||
| 919 | - * - The socket is closed via the socket's internal queue on thread B. | ||
| 920 | - * - Thread C opens a file, and subsequently receives the file descriptor that was previously the socket's FD. | ||
| 921 | - * - Thread A is now accessing/altering the file instead of the socket. | ||
| 922 | - * | ||
| 923 | - * In addition to this, other variables are not actually objects, | ||
| 924 | - * and thus cannot be retained/released or even autoreleased. | ||
| 925 | - * An example is the sslContext, of type SSLContextRef, which is actually a malloc'd struct. | ||
| 926 | - * | ||
| 927 | - * Although there are internal variables that make it difficult to maintain thread-safety, | ||
| 928 | - * it is important to provide access to these variables | ||
| 929 | - * to ensure this class can be used in a wide array of environments. | ||
| 930 | - * This method helps to accomplish this by invoking the current block on the socket's internal queue. | ||
| 931 | - * The methods below can be invoked from within the block to access | ||
| 932 | - * those generally thread-unsafe internal variables in a thread-safe manner. | ||
| 933 | - * The given block will be invoked synchronously on the socket's internal queue. | ||
| 934 | - * | ||
| 935 | - * If you save references to any protected variables and use them outside the block, you do so at your own peril. | ||
| 936 | -**/ | ||
| 937 | -- (void)performBlock:(dispatch_block_t)block; | ||
| 938 | - | ||
| 939 | -/** | ||
| 940 | - * These methods are only available from within the context of a performBlock: invocation. | ||
| 941 | - * See the documentation for the performBlock: method above. | ||
| 942 | - * | ||
| 943 | - * Provides access to the socket's file descriptor(s). | ||
| 944 | - * If the socket isn't connected, or explicity bound to a particular interface, | ||
| 945 | - * it might actually have multiple internal socket file descriptors - one for IPv4 and one for IPv6. | ||
| 946 | -**/ | ||
| 947 | -- (int)socketFD; | ||
| 948 | -- (int)socket4FD; | ||
| 949 | -- (int)socket6FD; | ||
| 950 | - | ||
| 951 | -#if TARGET_OS_IPHONE | ||
| 952 | - | ||
| 953 | -/** | ||
| 954 | - * These methods are only available from within the context of a performBlock: invocation. | ||
| 955 | - * See the documentation for the performBlock: method above. | ||
| 956 | - * | ||
| 957 | - * Returns (creating if necessary) a CFReadStream/CFWriteStream for the internal socket. | ||
| 958 | - * | ||
| 959 | - * Generally GCDAsyncUdpSocket doesn't use CFStream. (It uses the faster GCD API's.) | ||
| 960 | - * However, if you need one for any reason, | ||
| 961 | - * these methods are a convenient way to get access to a safe instance of one. | ||
| 962 | -**/ | ||
| 963 | -- (CFReadStreamRef)readStream; | ||
| 964 | -- (CFWriteStreamRef)writeStream; | ||
| 965 | - | ||
| 966 | -/** | ||
| 967 | - * This method is only available from within the context of a performBlock: invocation. | ||
| 968 | - * See the documentation for the performBlock: method above. | ||
| 969 | - * | ||
| 970 | - * Configures the socket to allow it to operate when the iOS application has been backgrounded. | ||
| 971 | - * In other words, this method creates a read & write stream, and invokes: | ||
| 972 | - * | ||
| 973 | - * CFReadStreamSetProperty(readStream, kCFStreamNetworkServiceType, kCFStreamNetworkServiceTypeVoIP); | ||
| 974 | - * CFWriteStreamSetProperty(writeStream, kCFStreamNetworkServiceType, kCFStreamNetworkServiceTypeVoIP); | ||
| 975 | - * | ||
| 976 | - * Returns YES if successful, NO otherwise. | ||
| 977 | - * | ||
| 978 | - * Example usage: | ||
| 979 | - * | ||
| 980 | - * [asyncUdpSocket performBlock:^{ | ||
| 981 | - * [asyncUdpSocket enableBackgroundingOnSocket]; | ||
| 982 | - * }]; | ||
| 983 | - * | ||
| 984 | - * | ||
| 985 | - * NOTE : Apple doesn't currently support backgrounding UDP sockets. (Only TCP for now). | ||
| 986 | -**/ | ||
| 987 | -//- (BOOL)enableBackgroundingOnSockets; | ||
| 988 | - | ||
| 989 | -#endif | ||
| 990 | - | ||
| 991 | -#pragma mark Utilities | ||
| 992 | - | ||
| 993 | -/** | ||
| 994 | - * Extracting host/port/family information from raw address data. | ||
| 995 | -**/ | ||
| 996 | - | ||
| 997 | -+ (nullable NSString *)hostFromAddress:(NSData *)address; | ||
| 998 | -+ (uint16_t)portFromAddress:(NSData *)address; | ||
| 999 | -+ (int)familyFromAddress:(NSData *)address; | ||
| 1000 | - | ||
| 1001 | -+ (BOOL)isIPv4Address:(NSData *)address; | ||
| 1002 | -+ (BOOL)isIPv6Address:(NSData *)address; | ||
| 1003 | - | ||
| 1004 | -+ (BOOL)getHost:(NSString * __nullable * __nullable)hostPtr port:(uint16_t * __nullable)portPtr fromAddress:(NSData *)address; | ||
| 1005 | -+ (BOOL)getHost:(NSString * __nullable * __nullable)hostPtr port:(uint16_t * __nullable)portPtr family:(int * __nullable)afPtr fromAddress:(NSData *)address; | ||
| 1006 | - | ||
| 1007 | -@end | ||
| 1008 | - | ||
| 1009 | -NS_ASSUME_NONNULL_END |
CNLiveXMPPManagerDemo/CocoaAsyncSocket.framework/Info.plist deleted
100644 → 0
No preview for this file type
CNLiveXMPPManagerDemo/CocoaAsyncSocket.framework/Modules/module.modulemap deleted
100644 → 0
CNLiveXMPPManagerDemo/CocoaLumberjack.framework/CocoaLumberjack deleted
100755 → 0
No preview for this file type
CNLiveXMPPManagerDemo/CocoaLumberjack.framework/Headers/CocoaLumberjack.h deleted
100644 → 0
| 1 | -// Software License Agreement (BSD License) | ||
| 2 | -// | ||
| 3 | -// Copyright (c) 2010-2016, Deusty, LLC | ||
| 4 | -// All rights reserved. | ||
| 5 | -// | ||
| 6 | -// Redistribution and use of this software in source and binary forms, | ||
| 7 | -// with or without modification, are permitted provided that the following conditions are met: | ||
| 8 | -// | ||
| 9 | -// * Redistributions of source code must retain the above copyright notice, | ||
| 10 | -// this list of conditions and the following disclaimer. | ||
| 11 | -// | ||
| 12 | -// * Neither the name of Deusty nor the names of its contributors may be used | ||
| 13 | -// to endorse or promote products derived from this software without specific | ||
| 14 | -// prior written permission of Deusty, LLC. | ||
| 15 | - | ||
| 16 | -/** | ||
| 17 | - * Welcome to CocoaLumberjack! | ||
| 18 | - * | ||
| 19 | - * The project page has a wealth of documentation if you have any questions. | ||
| 20 | - * https://github.com/CocoaLumberjack/CocoaLumberjack | ||
| 21 | - * | ||
| 22 | - * If you're new to the project you may wish to read "Getting Started" at: | ||
| 23 | - * Documentation/GettingStarted.md | ||
| 24 | - * | ||
| 25 | - * Otherwise, here is a quick refresher. | ||
| 26 | - * There are three steps to using the macros: | ||
| 27 | - * | ||
| 28 | - * Step 1: | ||
| 29 | - * Import the header in your implementation or prefix file: | ||
| 30 | - * | ||
| 31 | - * #import <CocoaLumberjack/CocoaLumberjack.h> | ||
| 32 | - * | ||
| 33 | - * Step 2: | ||
| 34 | - * Define your logging level in your implementation file: | ||
| 35 | - * | ||
| 36 | - * // Log levels: off, error, warn, info, verbose | ||
| 37 | - * static const DDLogLevel ddLogLevel = DDLogLevelVerbose; | ||
| 38 | - * | ||
| 39 | - * Step 2 [3rd party frameworks]: | ||
| 40 | - * | ||
| 41 | - * Define your LOG_LEVEL_DEF to a different variable/function than ddLogLevel: | ||
| 42 | - * | ||
| 43 | - * // #undef LOG_LEVEL_DEF // Undefine first only if needed | ||
| 44 | - * #define LOG_LEVEL_DEF myLibLogLevel | ||
| 45 | - * | ||
| 46 | - * Define your logging level in your implementation file: | ||
| 47 | - * | ||
| 48 | - * // Log levels: off, error, warn, info, verbose | ||
| 49 | - * static const DDLogLevel myLibLogLevel = DDLogLevelVerbose; | ||
| 50 | - * | ||
| 51 | - * Step 3: | ||
| 52 | - * Replace your NSLog statements with DDLog statements according to the severity of the message. | ||
| 53 | - * | ||
| 54 | - * NSLog(@"Fatal error, no dohickey found!"); -> DDLogError(@"Fatal error, no dohickey found!"); | ||
| 55 | - * | ||
| 56 | - * DDLog works exactly the same as NSLog. | ||
| 57 | - * This means you can pass it multiple variables just like NSLog. | ||
| 58 | - **/ | ||
| 59 | - | ||
| 60 | -#import <Foundation/Foundation.h> | ||
| 61 | - | ||
| 62 | -// Disable legacy macros | ||
| 63 | -#ifndef DD_LEGACY_MACROS | ||
| 64 | - #define DD_LEGACY_MACROS 0 | ||
| 65 | -#endif | ||
| 66 | - | ||
| 67 | -// Core | ||
| 68 | -#import "DDLog.h" | ||
| 69 | - | ||
| 70 | -// Main macros | ||
| 71 | -#import "DDLogMacros.h" | ||
| 72 | -#import "DDAssertMacros.h" | ||
| 73 | - | ||
| 74 | -// Capture ASL | ||
| 75 | -#import "DDASLLogCapture.h" | ||
| 76 | - | ||
| 77 | -// Loggers | ||
| 78 | -#import "DDTTYLogger.h" | ||
| 79 | -#import "DDASLLogger.h" | ||
| 80 | -#import "DDFileLogger.h" | ||
| 81 | - |
CNLiveXMPPManagerDemo/CocoaLumberjack.framework/Headers/DDASLLogCapture.h deleted
100644 → 0
| 1 | -// Software License Agreement (BSD License) | ||
| 2 | -// | ||
| 3 | -// Copyright (c) 2010-2016, Deusty, LLC | ||
| 4 | -// All rights reserved. | ||
| 5 | -// | ||
| 6 | -// Redistribution and use of this software in source and binary forms, | ||
| 7 | -// with or without modification, are permitted provided that the following conditions are met: | ||
| 8 | -// | ||
| 9 | -// * Redistributions of source code must retain the above copyright notice, | ||
| 10 | -// this list of conditions and the following disclaimer. | ||
| 11 | -// | ||
| 12 | -// * Neither the name of Deusty nor the names of its contributors may be used | ||
| 13 | -// to endorse or promote products derived from this software without specific | ||
| 14 | -// prior written permission of Deusty, LLC. | ||
| 15 | - | ||
| 16 | -#import "DDASLLogger.h" | ||
| 17 | - | ||
| 18 | -@protocol DDLogger; | ||
| 19 | - | ||
| 20 | -/** | ||
| 21 | - * This class provides the ability to capture the ASL (Apple System Logs) | ||
| 22 | - */ | ||
| 23 | -@interface DDASLLogCapture : NSObject | ||
| 24 | - | ||
| 25 | -/** | ||
| 26 | - * Start capturing logs | ||
| 27 | - */ | ||
| 28 | -+ (void)start; | ||
| 29 | - | ||
| 30 | -/** | ||
| 31 | - * Stop capturing logs | ||
| 32 | - */ | ||
| 33 | -+ (void)stop; | ||
| 34 | - | ||
| 35 | -/** | ||
| 36 | - * Returns the current capture level. | ||
| 37 | - * @note Default log level: DDLogLevelVerbose (i.e. capture all ASL messages). | ||
| 38 | - */ | ||
| 39 | -+ (DDLogLevel)captureLevel; | ||
| 40 | - | ||
| 41 | -/** | ||
| 42 | - * Set the capture level | ||
| 43 | - * | ||
| 44 | - * @param level new level | ||
| 45 | - */ | ||
| 46 | -+ (void)setCaptureLevel:(DDLogLevel)level; | ||
| 47 | - | ||
| 48 | -@end |
CNLiveXMPPManagerDemo/CocoaLumberjack.framework/Headers/DDASLLogger.h deleted
100644 → 0
| 1 | -// Software License Agreement (BSD License) | ||
| 2 | -// | ||
| 3 | -// Copyright (c) 2010-2016, Deusty, LLC | ||
| 4 | -// All rights reserved. | ||
| 5 | -// | ||
| 6 | -// Redistribution and use of this software in source and binary forms, | ||
| 7 | -// with or without modification, are permitted provided that the following conditions are met: | ||
| 8 | -// | ||
| 9 | -// * Redistributions of source code must retain the above copyright notice, | ||
| 10 | -// this list of conditions and the following disclaimer. | ||
| 11 | -// | ||
| 12 | -// * Neither the name of Deusty nor the names of its contributors may be used | ||
| 13 | -// to endorse or promote products derived from this software without specific | ||
| 14 | -// prior written permission of Deusty, LLC. | ||
| 15 | - | ||
| 16 | -#import <Foundation/Foundation.h> | ||
| 17 | - | ||
| 18 | -// Disable legacy macros | ||
| 19 | -#ifndef DD_LEGACY_MACROS | ||
| 20 | - #define DD_LEGACY_MACROS 0 | ||
| 21 | -#endif | ||
| 22 | - | ||
| 23 | -#import "DDLog.h" | ||
| 24 | - | ||
| 25 | -// Custom key set on messages sent to ASL | ||
| 26 | -extern const char* const kDDASLKeyDDLog; | ||
| 27 | - | ||
| 28 | -// Value set for kDDASLKeyDDLog | ||
| 29 | -extern const char* const kDDASLDDLogValue; | ||
| 30 | - | ||
| 31 | -/** | ||
| 32 | - * This class provides a logger for the Apple System Log facility. | ||
| 33 | - * | ||
| 34 | - * As described in the "Getting Started" page, | ||
| 35 | - * the traditional NSLog() function directs its output to two places: | ||
| 36 | - * | ||
| 37 | - * - Apple System Log | ||
| 38 | - * - StdErr (if stderr is a TTY) so log statements show up in Xcode console | ||
| 39 | - * | ||
| 40 | - * To duplicate NSLog() functionality you can simply add this logger and a tty logger. | ||
| 41 | - * However, if you instead choose to use file logging (for faster performance), | ||
| 42 | - * you may choose to use a file logger and a tty logger. | ||
| 43 | - **/ | ||
| 44 | -@interface DDASLLogger : DDAbstractLogger <DDLogger> | ||
| 45 | - | ||
| 46 | -/** | ||
| 47 | - * Singleton method | ||
| 48 | - * | ||
| 49 | - * @return the shared instance | ||
| 50 | - */ | ||
| 51 | -+ (instancetype)sharedInstance; | ||
| 52 | - | ||
| 53 | -// Inherited from DDAbstractLogger | ||
| 54 | - | ||
| 55 | -// - (id <DDLogFormatter>)logFormatter; | ||
| 56 | -// - (void)setLogFormatter:(id <DDLogFormatter>)formatter; | ||
| 57 | - | ||
| 58 | -@end |
CNLiveXMPPManagerDemo/CocoaLumberjack.framework/Headers/DDAbstractDatabaseLogger.h deleted
100644 → 0
| 1 | -// Software License Agreement (BSD License) | ||
| 2 | -// | ||
| 3 | -// Copyright (c) 2010-2016, Deusty, LLC | ||
| 4 | -// All rights reserved. | ||
| 5 | -// | ||
| 6 | -// Redistribution and use of this software in source and binary forms, | ||
| 7 | -// with or without modification, are permitted provided that the following conditions are met: | ||
| 8 | -// | ||
| 9 | -// * Redistributions of source code must retain the above copyright notice, | ||
| 10 | -// this list of conditions and the following disclaimer. | ||
| 11 | -// | ||
| 12 | -// * Neither the name of Deusty nor the names of its contributors may be used | ||
| 13 | -// to endorse or promote products derived from this software without specific | ||
| 14 | -// prior written permission of Deusty, LLC. | ||
| 15 | - | ||
| 16 | -// Disable legacy macros | ||
| 17 | -#ifndef DD_LEGACY_MACROS | ||
| 18 | - #define DD_LEGACY_MACROS 0 | ||
| 19 | -#endif | ||
| 20 | - | ||
| 21 | -#import "DDLog.h" | ||
| 22 | - | ||
| 23 | -/** | ||
| 24 | - * This class provides an abstract implementation of a database logger. | ||
| 25 | - * | ||
| 26 | - * That is, it provides the base implementation for a database logger to build atop of. | ||
| 27 | - * All that is needed for a concrete database logger is to extend this class | ||
| 28 | - * and override the methods in the implementation file that are prefixed with "db_". | ||
| 29 | - **/ | ||
| 30 | -@interface DDAbstractDatabaseLogger : DDAbstractLogger { | ||
| 31 | - | ||
| 32 | -@protected | ||
| 33 | - NSUInteger _saveThreshold; | ||
| 34 | - NSTimeInterval _saveInterval; | ||
| 35 | - NSTimeInterval _maxAge; | ||
| 36 | - NSTimeInterval _deleteInterval; | ||
| 37 | - BOOL _deleteOnEverySave; | ||
| 38 | - | ||
| 39 | - BOOL _saveTimerSuspended; | ||
| 40 | - NSUInteger _unsavedCount; | ||
| 41 | - dispatch_time_t _unsavedTime; | ||
| 42 | - dispatch_source_t _saveTimer; | ||
| 43 | - dispatch_time_t _lastDeleteTime; | ||
| 44 | - dispatch_source_t _deleteTimer; | ||
| 45 | -} | ||
| 46 | - | ||
| 47 | -/** | ||
| 48 | - * Specifies how often to save the data to disk. | ||
| 49 | - * Since saving is an expensive operation (disk io) it is not done after every log statement. | ||
| 50 | - * These properties allow you to configure how/when the logger saves to disk. | ||
| 51 | - * | ||
| 52 | - * A save is done when either (whichever happens first): | ||
| 53 | - * | ||
| 54 | - * - The number of unsaved log entries reaches saveThreshold | ||
| 55 | - * - The amount of time since the oldest unsaved log entry was created reaches saveInterval | ||
| 56 | - * | ||
| 57 | - * You can optionally disable the saveThreshold by setting it to zero. | ||
| 58 | - * If you disable the saveThreshold you are entirely dependent on the saveInterval. | ||
| 59 | - * | ||
| 60 | - * You can optionally disable the saveInterval by setting it to zero (or a negative value). | ||
| 61 | - * If you disable the saveInterval you are entirely dependent on the saveThreshold. | ||
| 62 | - * | ||
| 63 | - * It's not wise to disable both saveThreshold and saveInterval. | ||
| 64 | - * | ||
| 65 | - * The default saveThreshold is 500. | ||
| 66 | - * The default saveInterval is 60 seconds. | ||
| 67 | - **/ | ||
| 68 | -@property (assign, readwrite) NSUInteger saveThreshold; | ||
| 69 | - | ||
| 70 | -/** | ||
| 71 | - * See the description for the `saveThreshold` property | ||
| 72 | - */ | ||
| 73 | -@property (assign, readwrite) NSTimeInterval saveInterval; | ||
| 74 | - | ||
| 75 | -/** | ||
| 76 | - * It is likely you don't want the log entries to persist forever. | ||
| 77 | - * Doing so would allow the database to grow infinitely large over time. | ||
| 78 | - * | ||
| 79 | - * The maxAge property provides a way to specify how old a log statement can get | ||
| 80 | - * before it should get deleted from the database. | ||
| 81 | - * | ||
| 82 | - * The deleteInterval specifies how often to sweep for old log entries. | ||
| 83 | - * Since deleting is an expensive operation (disk io) is is done on a fixed interval. | ||
| 84 | - * | ||
| 85 | - * An alternative to the deleteInterval is the deleteOnEverySave option. | ||
| 86 | - * This specifies that old log entries should be deleted during every save operation. | ||
| 87 | - * | ||
| 88 | - * You can optionally disable the maxAge by setting it to zero (or a negative value). | ||
| 89 | - * If you disable the maxAge then old log statements are not deleted. | ||
| 90 | - * | ||
| 91 | - * You can optionally disable the deleteInterval by setting it to zero (or a negative value). | ||
| 92 | - * | ||
| 93 | - * If you disable both deleteInterval and deleteOnEverySave then old log statements are not deleted. | ||
| 94 | - * | ||
| 95 | - * It's not wise to enable both deleteInterval and deleteOnEverySave. | ||
| 96 | - * | ||
| 97 | - * The default maxAge is 7 days. | ||
| 98 | - * The default deleteInterval is 5 minutes. | ||
| 99 | - * The default deleteOnEverySave is NO. | ||
| 100 | - **/ | ||
| 101 | -@property (assign, readwrite) NSTimeInterval maxAge; | ||
| 102 | - | ||
| 103 | -/** | ||
| 104 | - * See the description for the `maxAge` property | ||
| 105 | - */ | ||
| 106 | -@property (assign, readwrite) NSTimeInterval deleteInterval; | ||
| 107 | - | ||
| 108 | -/** | ||
| 109 | - * See the description for the `maxAge` property | ||
| 110 | - */ | ||
| 111 | -@property (assign, readwrite) BOOL deleteOnEverySave; | ||
| 112 | - | ||
| 113 | -/** | ||
| 114 | - * Forces a save of any pending log entries (flushes log entries to disk). | ||
| 115 | - **/ | ||
| 116 | -- (void)savePendingLogEntries; | ||
| 117 | - | ||
| 118 | -/** | ||
| 119 | - * Removes any log entries that are older than maxAge. | ||
| 120 | - **/ | ||
| 121 | -- (void)deleteOldLogEntries; | ||
| 122 | - | ||
| 123 | -@end |
CNLiveXMPPManagerDemo/CocoaLumberjack.framework/Headers/DDAssertMacros.h deleted
100644 → 0
| 1 | -// Software License Agreement (BSD License) | ||
| 2 | -// | ||
| 3 | -// Copyright (c) 2010-2016, Deusty, LLC | ||
| 4 | -// All rights reserved. | ||
| 5 | -// | ||
| 6 | -// Redistribution and use of this software in source and binary forms, | ||
| 7 | -// with or without modification, are permitted provided that the following conditions are met: | ||
| 8 | -// | ||
| 9 | -// * Redistributions of source code must retain the above copyright notice, | ||
| 10 | -// this list of conditions and the following disclaimer. | ||
| 11 | -// | ||
| 12 | -// * Neither the name of Deusty nor the names of its contributors may be used | ||
| 13 | -// to endorse or promote products derived from this software without specific | ||
| 14 | -// prior written permission of Deusty, LLC. | ||
| 15 | - | ||
| 16 | -/** | ||
| 17 | - * NSAsset replacement that will output a log message even when assertions are disabled. | ||
| 18 | - **/ | ||
| 19 | -#define DDAssert(condition, frmt, ...) \ | ||
| 20 | - if (!(condition)) { \ | ||
| 21 | - NSString *description = [NSString stringWithFormat:frmt, ## __VA_ARGS__]; \ | ||
| 22 | - DDLogError(@"%@", description); \ | ||
| 23 | - NSAssert(NO, description); \ | ||
| 24 | - } | ||
| 25 | -#define DDAssertCondition(condition) DDAssert(condition, @"Condition not satisfied: %s", #condition) | ||
| 26 | - |
CNLiveXMPPManagerDemo/CocoaLumberjack.framework/Headers/DDContextFilterLogFormatter.h deleted
100644 → 0
| 1 | -// Software License Agreement (BSD License) | ||
| 2 | -// | ||
| 3 | -// Copyright (c) 2010-2016, Deusty, LLC | ||
| 4 | -// All rights reserved. | ||
| 5 | -// | ||
| 6 | -// Redistribution and use of this software in source and binary forms, | ||
| 7 | -// with or without modification, are permitted provided that the following conditions are met: | ||
| 8 | -// | ||
| 9 | -// * Redistributions of source code must retain the above copyright notice, | ||
| 10 | -// this list of conditions and the following disclaimer. | ||
| 11 | -// | ||
| 12 | -// * Neither the name of Deusty nor the names of its contributors may be used | ||
| 13 | -// to endorse or promote products derived from this software without specific | ||
| 14 | -// prior written permission of Deusty, LLC. | ||
| 15 | - | ||
| 16 | -#import <Foundation/Foundation.h> | ||
| 17 | - | ||
| 18 | -// Disable legacy macros | ||
| 19 | -#ifndef DD_LEGACY_MACROS | ||
| 20 | - #define DD_LEGACY_MACROS 0 | ||
| 21 | -#endif | ||
| 22 | - | ||
| 23 | -#import "DDLog.h" | ||
| 24 | - | ||
| 25 | -/** | ||
| 26 | - * This class provides a log formatter that filters log statements from a logging context not on the whitelist. | ||
| 27 | - * | ||
| 28 | - * A log formatter can be added to any logger to format and/or filter its output. | ||
| 29 | - * You can learn more about log formatters here: | ||
| 30 | - * Documentation/CustomFormatters.md | ||
| 31 | - * | ||
| 32 | - * You can learn more about logging context's here: | ||
| 33 | - * Documentation/CustomContext.md | ||
| 34 | - * | ||
| 35 | - * But here's a quick overview / refresher: | ||
| 36 | - * | ||
| 37 | - * Every log statement has a logging context. | ||
| 38 | - * These come from the underlying logging macros defined in DDLog.h. | ||
| 39 | - * The default logging context is zero. | ||
| 40 | - * You can define multiple logging context's for use in your application. | ||
| 41 | - * For example, logically separate parts of your app each have a different logging context. | ||
| 42 | - * Also 3rd party frameworks that make use of Lumberjack generally use their own dedicated logging context. | ||
| 43 | - **/ | ||
| 44 | -@interface DDContextWhitelistFilterLogFormatter : NSObject <DDLogFormatter> | ||
| 45 | - | ||
| 46 | -/** | ||
| 47 | - * Designated default initializer | ||
| 48 | - */ | ||
| 49 | -- (instancetype)init NS_DESIGNATED_INITIALIZER; | ||
| 50 | - | ||
| 51 | -/** | ||
| 52 | - * Add a context to the whitelist | ||
| 53 | - * | ||
| 54 | - * @param loggingContext the context | ||
| 55 | - */ | ||
| 56 | -- (void)addToWhitelist:(NSUInteger)loggingContext; | ||
| 57 | - | ||
| 58 | -/** | ||
| 59 | - * Remove context from whitelist | ||
| 60 | - * | ||
| 61 | - * @param loggingContext the context | ||
| 62 | - */ | ||
| 63 | -- (void)removeFromWhitelist:(NSUInteger)loggingContext; | ||
| 64 | - | ||
| 65 | -/** | ||
| 66 | - * Return the whitelist | ||
| 67 | - */ | ||
| 68 | -@property (readonly, copy) NSArray *whitelist; | ||
| 69 | - | ||
| 70 | -/** | ||
| 71 | - * Check if a context is on the whitelist | ||
| 72 | - * | ||
| 73 | - * @param loggingContext the context | ||
| 74 | - */ | ||
| 75 | -- (BOOL)isOnWhitelist:(NSUInteger)loggingContext; | ||
| 76 | - | ||
| 77 | -@end | ||
| 78 | - | ||
| 79 | -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
| 80 | -#pragma mark - | ||
| 81 | -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
| 82 | - | ||
| 83 | -/** | ||
| 84 | - * This class provides a log formatter that filters log statements from a logging context on the blacklist. | ||
| 85 | - **/ | ||
| 86 | -@interface DDContextBlacklistFilterLogFormatter : NSObject <DDLogFormatter> | ||
| 87 | - | ||
| 88 | -- (instancetype)init NS_DESIGNATED_INITIALIZER; | ||
| 89 | - | ||
| 90 | -/** | ||
| 91 | - * Add a context to the blacklist | ||
| 92 | - * | ||
| 93 | - * @param loggingContext the context | ||
| 94 | - */ | ||
| 95 | -- (void)addToBlacklist:(NSUInteger)loggingContext; | ||
| 96 | - | ||
| 97 | -/** | ||
| 98 | - * Remove context from blacklist | ||
| 99 | - * | ||
| 100 | - * @param loggingContext the context | ||
| 101 | - */ | ||
| 102 | -- (void)removeFromBlacklist:(NSUInteger)loggingContext; | ||
| 103 | - | ||
| 104 | -/** | ||
| 105 | - * Return the blacklist | ||
| 106 | - */ | ||
| 107 | -@property (readonly, copy) NSArray *blacklist; | ||
| 108 | - | ||
| 109 | - | ||
| 110 | -/** | ||
| 111 | - * Check if a context is on the blacklist | ||
| 112 | - * | ||
| 113 | - * @param loggingContext the context | ||
| 114 | - */ | ||
| 115 | -- (BOOL)isOnBlacklist:(NSUInteger)loggingContext; | ||
| 116 | - | ||
| 117 | -@end |
CNLiveXMPPManagerDemo/CocoaLumberjack.framework/Headers/DDDispatchQueueLogFormatter.h deleted
100644 → 0
| 1 | -// Software License Agreement (BSD License) | ||
| 2 | -// | ||
| 3 | -// Copyright (c) 2010-2016, Deusty, LLC | ||
| 4 | -// All rights reserved. | ||
| 5 | -// | ||
| 6 | -// Redistribution and use of this software in source and binary forms, | ||
| 7 | -// with or without modification, are permitted provided that the following conditions are met: | ||
| 8 | -// | ||
| 9 | -// * Redistributions of source code must retain the above copyright notice, | ||
| 10 | -// this list of conditions and the following disclaimer. | ||
| 11 | -// | ||
| 12 | -// * Neither the name of Deusty nor the names of its contributors may be used | ||
| 13 | -// to endorse or promote products derived from this software without specific | ||
| 14 | -// prior written permission of Deusty, LLC. | ||
| 15 | - | ||
| 16 | -#import <Foundation/Foundation.h> | ||
| 17 | -#import <libkern/OSAtomic.h> | ||
| 18 | - | ||
| 19 | -// Disable legacy macros | ||
| 20 | -#ifndef DD_LEGACY_MACROS | ||
| 21 | - #define DD_LEGACY_MACROS 0 | ||
| 22 | -#endif | ||
| 23 | - | ||
| 24 | -#import "DDLog.h" | ||
| 25 | - | ||
| 26 | -/** | ||
| 27 | - * Log formatter mode | ||
| 28 | - */ | ||
| 29 | -typedef NS_ENUM(NSUInteger, DDDispatchQueueLogFormatterMode){ | ||
| 30 | - /** | ||
| 31 | - * This is the default option, means the formatter can be reused between multiple loggers and therefore is thread-safe. | ||
| 32 | - * There is, of course, a performance cost for the thread-safety | ||
| 33 | - */ | ||
| 34 | - DDDispatchQueueLogFormatterModeShareble = 0, | ||
| 35 | - /** | ||
| 36 | - * If the formatter will only be used by a single logger, then the thread-safety can be removed | ||
| 37 | - * @note: there is an assert checking if the formatter is added to multiple loggers and the mode is non-shareble | ||
| 38 | - */ | ||
| 39 | - DDDispatchQueueLogFormatterModeNonShareble, | ||
| 40 | -}; | ||
| 41 | - | ||
| 42 | - | ||
| 43 | -/** | ||
| 44 | - * This class provides a log formatter that prints the dispatch_queue label instead of the mach_thread_id. | ||
| 45 | - * | ||
| 46 | - * A log formatter can be added to any logger to format and/or filter its output. | ||
| 47 | - * You can learn more about log formatters here: | ||
| 48 | - * Documentation/CustomFormatters.md | ||
| 49 | - * | ||
| 50 | - * A typical `NSLog` (or `DDTTYLogger`) prints detailed info as `[<process_id>:<thread_id>]`. | ||
| 51 | - * For example: | ||
| 52 | - * | ||
| 53 | - * `2011-10-17 20:21:45.435 AppName[19928:5207] Your log message here` | ||
| 54 | - * | ||
| 55 | - * Where: | ||
| 56 | - * `- 19928 = process id` | ||
| 57 | - * `- 5207 = thread id (mach_thread_id printed in hex)` | ||
| 58 | - * | ||
| 59 | - * When using grand central dispatch (GCD), this information is less useful. | ||
| 60 | - * This is because a single serial dispatch queue may be run on any thread from an internally managed thread pool. | ||
| 61 | - * For example: | ||
| 62 | - * | ||
| 63 | - * `2011-10-17 20:32:31.111 AppName[19954:4d07] Message from my_serial_dispatch_queue` | ||
| 64 | - * `2011-10-17 20:32:31.112 AppName[19954:5207] Message from my_serial_dispatch_queue` | ||
| 65 | - * `2011-10-17 20:32:31.113 AppName[19954:2c55] Message from my_serial_dispatch_queue` | ||
| 66 | - * | ||
| 67 | - * This formatter allows you to replace the standard `[box:info]` with the dispatch_queue name. | ||
| 68 | - * For example: | ||
| 69 | - * | ||
| 70 | - * `2011-10-17 20:32:31.111 AppName[img-scaling] Message from my_serial_dispatch_queue` | ||
| 71 | - * `2011-10-17 20:32:31.112 AppName[img-scaling] Message from my_serial_dispatch_queue` | ||
| 72 | - * `2011-10-17 20:32:31.113 AppName[img-scaling] Message from my_serial_dispatch_queue` | ||
| 73 | - * | ||
| 74 | - * If the dispatch_queue doesn't have a set name, then it falls back to the thread name. | ||
| 75 | - * If the current thread doesn't have a set name, then it falls back to the mach_thread_id in hex (like normal). | ||
| 76 | - * | ||
| 77 | - * Note: If manually creating your own background threads (via `NSThread/alloc/init` or `NSThread/detachNeThread`), | ||
| 78 | - * you can use `[[NSThread currentThread] setName:(NSString *)]`. | ||
| 79 | - **/ | ||
| 80 | -@interface DDDispatchQueueLogFormatter : NSObject <DDLogFormatter> | ||
| 81 | - | ||
| 82 | -/** | ||
| 83 | - * Standard init method. | ||
| 84 | - * Configure using properties as desired. | ||
| 85 | - **/ | ||
| 86 | -- (instancetype)init NS_DESIGNATED_INITIALIZER; | ||
| 87 | - | ||
| 88 | -/** | ||
| 89 | - * Initializer with ability to set the queue mode | ||
| 90 | - * | ||
| 91 | - * @param mode choose between DDDispatchQueueLogFormatterModeShareble and DDDispatchQueueLogFormatterModeNonShareble, depending if the formatter is shared between several loggers or not | ||
| 92 | - */ | ||
| 93 | -- (instancetype)initWithMode:(DDDispatchQueueLogFormatterMode)mode; | ||
| 94 | - | ||
| 95 | -/** | ||
| 96 | - * The minQueueLength restricts the minimum size of the [detail box]. | ||
| 97 | - * If the minQueueLength is set to 0, there is no restriction. | ||
| 98 | - * | ||
| 99 | - * For example, say a dispatch_queue has a label of "diskIO": | ||
| 100 | - * | ||
| 101 | - * If the minQueueLength is 0: [diskIO] | ||
| 102 | - * If the minQueueLength is 4: [diskIO] | ||
| 103 | - * If the minQueueLength is 5: [diskIO] | ||
| 104 | - * If the minQueueLength is 6: [diskIO] | ||
| 105 | - * If the minQueueLength is 7: [diskIO ] | ||
| 106 | - * If the minQueueLength is 8: [diskIO ] | ||
| 107 | - * | ||
| 108 | - * The default minQueueLength is 0 (no minimum, so [detail box] won't be padded). | ||
| 109 | - * | ||
| 110 | - * If you want every [detail box] to have the exact same width, | ||
| 111 | - * set both minQueueLength and maxQueueLength to the same value. | ||
| 112 | - **/ | ||
| 113 | -@property (assign, atomic) NSUInteger minQueueLength; | ||
| 114 | - | ||
| 115 | -/** | ||
| 116 | - * The maxQueueLength restricts the number of characters that will be inside the [detail box]. | ||
| 117 | - * If the maxQueueLength is 0, there is no restriction. | ||
| 118 | - * | ||
| 119 | - * For example, say a dispatch_queue has a label of "diskIO": | ||
| 120 | - * | ||
| 121 | - * If the maxQueueLength is 0: [diskIO] | ||
| 122 | - * If the maxQueueLength is 4: [disk] | ||
| 123 | - * If the maxQueueLength is 5: [diskI] | ||
| 124 | - * If the maxQueueLength is 6: [diskIO] | ||
| 125 | - * If the maxQueueLength is 7: [diskIO] | ||
| 126 | - * If the maxQueueLength is 8: [diskIO] | ||
| 127 | - * | ||
| 128 | - * The default maxQueueLength is 0 (no maximum, so [detail box] won't be truncated). | ||
| 129 | - * | ||
| 130 | - * If you want every [detail box] to have the exact same width, | ||
| 131 | - * set both minQueueLength and maxQueueLength to the same value. | ||
| 132 | - **/ | ||
| 133 | -@property (assign, atomic) NSUInteger maxQueueLength; | ||
| 134 | - | ||
| 135 | -/** | ||
| 136 | - * Sometimes queue labels have long names like "com.apple.main-queue", | ||
| 137 | - * but you'd prefer something shorter like simply "main". | ||
| 138 | - * | ||
| 139 | - * This method allows you to set such preferred replacements. | ||
| 140 | - * The above example is set by default. | ||
| 141 | - * | ||
| 142 | - * To remove/undo a previous replacement, invoke this method with nil for the 'shortLabel' parameter. | ||
| 143 | - **/ | ||
| 144 | -- (NSString *)replacementStringForQueueLabel:(NSString *)longLabel; | ||
| 145 | - | ||
| 146 | -/** | ||
| 147 | - * See the `replacementStringForQueueLabel:` description | ||
| 148 | - */ | ||
| 149 | -- (void)setReplacementString:(NSString *)shortLabel forQueueLabel:(NSString *)longLabel; | ||
| 150 | - | ||
| 151 | -@end | ||
| 152 | - | ||
| 153 | -/** | ||
| 154 | - * Category on `DDDispatchQueueLogFormatter` to make method declarations easier to extend/modify | ||
| 155 | - **/ | ||
| 156 | -@interface DDDispatchQueueLogFormatter (OverridableMethods) | ||
| 157 | - | ||
| 158 | -/** | ||
| 159 | - * Date formatter default configuration | ||
| 160 | - */ | ||
| 161 | -- (void)configureDateFormatter:(NSDateFormatter *)dateFormatter; | ||
| 162 | - | ||
| 163 | -/** | ||
| 164 | - * Formatter method to transfrom from date to string | ||
| 165 | - */ | ||
| 166 | -- (NSString *)stringFromDate:(NSDate *)date; | ||
| 167 | - | ||
| 168 | -/** | ||
| 169 | - * Method to compute the queue thread label | ||
| 170 | - */ | ||
| 171 | -- (NSString *)queueThreadLabelForLogMessage:(DDLogMessage *)logMessage; | ||
| 172 | - | ||
| 173 | -/** | ||
| 174 | - * The actual method that formats a message (transforms a `DDLogMessage` model into a printable string) | ||
| 175 | - */ | ||
| 176 | -- (NSString *)formatLogMessage:(DDLogMessage *)logMessage; | ||
| 177 | - | ||
| 178 | -@end |
CNLiveXMPPManagerDemo/CocoaLumberjack.framework/Headers/DDFileLogger.h deleted
100644 → 0
| 1 | -// Software License Agreement (BSD License) | ||
| 2 | -// | ||
| 3 | -// Copyright (c) 2010-2016, Deusty, LLC | ||
| 4 | -// All rights reserved. | ||
| 5 | -// | ||
| 6 | -// Redistribution and use of this software in source and binary forms, | ||
| 7 | -// with or without modification, are permitted provided that the following conditions are met: | ||
| 8 | -// | ||
| 9 | -// * Redistributions of source code must retain the above copyright notice, | ||
| 10 | -// this list of conditions and the following disclaimer. | ||
| 11 | -// | ||
| 12 | -// * Neither the name of Deusty nor the names of its contributors may be used | ||
| 13 | -// to endorse or promote products derived from this software without specific | ||
| 14 | -// prior written permission of Deusty, LLC. | ||
| 15 | - | ||
| 16 | -// Disable legacy macros | ||
| 17 | -#ifndef DD_LEGACY_MACROS | ||
| 18 | - #define DD_LEGACY_MACROS 0 | ||
| 19 | -#endif | ||
| 20 | - | ||
| 21 | -#import "DDLog.h" | ||
| 22 | - | ||
| 23 | -@class DDLogFileInfo; | ||
| 24 | - | ||
| 25 | -/** | ||
| 26 | - * This class provides a logger to write log statements to a file. | ||
| 27 | - **/ | ||
| 28 | - | ||
| 29 | - | ||
| 30 | -// Default configuration and safety/sanity values. | ||
| 31 | -// | ||
| 32 | -// maximumFileSize -> kDDDefaultLogMaxFileSize | ||
| 33 | -// rollingFrequency -> kDDDefaultLogRollingFrequency | ||
| 34 | -// maximumNumberOfLogFiles -> kDDDefaultLogMaxNumLogFiles | ||
| 35 | -// logFilesDiskQuota -> kDDDefaultLogFilesDiskQuota | ||
| 36 | -// | ||
| 37 | -// You should carefully consider the proper configuration values for your application. | ||
| 38 | - | ||
| 39 | -extern unsigned long long const kDDDefaultLogMaxFileSize; | ||
| 40 | -extern NSTimeInterval const kDDDefaultLogRollingFrequency; | ||
| 41 | -extern NSUInteger const kDDDefaultLogMaxNumLogFiles; | ||
| 42 | -extern unsigned long long const kDDDefaultLogFilesDiskQuota; | ||
| 43 | - | ||
| 44 | - | ||
| 45 | -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
| 46 | -#pragma mark - | ||
| 47 | -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
| 48 | - | ||
| 49 | -/** | ||
| 50 | - * The LogFileManager protocol is designed to allow you to control all aspects of your log files. | ||
| 51 | - * | ||
| 52 | - * The primary purpose of this is to allow you to do something with the log files after they have been rolled. | ||
| 53 | - * Perhaps you want to compress them to save disk space. | ||
| 54 | - * Perhaps you want to upload them to an FTP server. | ||
| 55 | - * Perhaps you want to run some analytics on the file. | ||
| 56 | - * | ||
| 57 | - * A default LogFileManager is, of course, provided. | ||
| 58 | - * The default LogFileManager simply deletes old log files according to the maximumNumberOfLogFiles property. | ||
| 59 | - * | ||
| 60 | - * This protocol provides various methods to fetch the list of log files. | ||
| 61 | - * | ||
| 62 | - * There are two variants: sorted and unsorted. | ||
| 63 | - * If sorting is not necessary, the unsorted variant is obviously faster. | ||
| 64 | - * The sorted variant will return an array sorted by when the log files were created, | ||
| 65 | - * with the most recently created log file at index 0, and the oldest log file at the end of the array. | ||
| 66 | - * | ||
| 67 | - * You can fetch only the log file paths (full path including name), log file names (name only), | ||
| 68 | - * or an array of `DDLogFileInfo` objects. | ||
| 69 | - * The `DDLogFileInfo` class is documented below, and provides a handy wrapper that | ||
| 70 | - * gives you easy access to various file attributes such as the creation date or the file size. | ||
| 71 | - */ | ||
| 72 | -@protocol DDLogFileManager <NSObject> | ||
| 73 | -@required | ||
| 74 | - | ||
| 75 | -// Public properties | ||
| 76 | - | ||
| 77 | -/** | ||
| 78 | - * The maximum number of archived log files to keep on disk. | ||
| 79 | - * For example, if this property is set to 3, | ||
| 80 | - * then the LogFileManager will only keep 3 archived log files (plus the current active log file) on disk. | ||
| 81 | - * Once the active log file is rolled/archived, then the oldest of the existing 3 rolled/archived log files is deleted. | ||
| 82 | - * | ||
| 83 | - * You may optionally disable this option by setting it to zero. | ||
| 84 | - **/ | ||
| 85 | -@property (readwrite, assign, atomic) NSUInteger maximumNumberOfLogFiles; | ||
| 86 | - | ||
| 87 | -/** | ||
| 88 | - * The maximum space that logs can take. On rolling logfile all old logfiles that exceed logFilesDiskQuota will | ||
| 89 | - * be deleted. | ||
| 90 | - * | ||
| 91 | - * You may optionally disable this option by setting it to zero. | ||
| 92 | - **/ | ||
| 93 | -@property (readwrite, assign, atomic) unsigned long long logFilesDiskQuota; | ||
| 94 | - | ||
| 95 | -// Public methods | ||
| 96 | - | ||
| 97 | -/** | ||
| 98 | - * Returns the logs directory (path) | ||
| 99 | - */ | ||
| 100 | -- (NSString *)logsDirectory; | ||
| 101 | - | ||
| 102 | -/** | ||
| 103 | - * Returns an array of `NSString` objects, | ||
| 104 | - * each of which is the filePath to an existing log file on disk. | ||
| 105 | - **/ | ||
| 106 | -- (NSArray *)unsortedLogFilePaths; | ||
| 107 | - | ||
| 108 | -/** | ||
| 109 | - * Returns an array of `NSString` objects, | ||
| 110 | - * each of which is the fileName of an existing log file on disk. | ||
| 111 | - **/ | ||
| 112 | -- (NSArray *)unsortedLogFileNames; | ||
| 113 | - | ||
| 114 | -/** | ||
| 115 | - * Returns an array of `DDLogFileInfo` objects, | ||
| 116 | - * each representing an existing log file on disk, | ||
| 117 | - * and containing important information about the log file such as it's modification date and size. | ||
| 118 | - **/ | ||
| 119 | -- (NSArray *)unsortedLogFileInfos; | ||
| 120 | - | ||
| 121 | -/** | ||
| 122 | - * Just like the `unsortedLogFilePaths` method, but sorts the array. | ||
| 123 | - * The items in the array are sorted by creation date. | ||
| 124 | - * The first item in the array will be the most recently created log file. | ||
| 125 | - **/ | ||
| 126 | -- (NSArray *)sortedLogFilePaths; | ||
| 127 | - | ||
| 128 | -/** | ||
| 129 | - * Just like the `unsortedLogFileNames` method, but sorts the array. | ||
| 130 | - * The items in the array are sorted by creation date. | ||
| 131 | - * The first item in the array will be the most recently created log file. | ||
| 132 | - **/ | ||
| 133 | -- (NSArray *)sortedLogFileNames; | ||
| 134 | - | ||
| 135 | -/** | ||
| 136 | - * Just like the `unsortedLogFileInfos` method, but sorts the array. | ||
| 137 | - * The items in the array are sorted by creation date. | ||
| 138 | - * The first item in the array will be the most recently created log file. | ||
| 139 | - **/ | ||
| 140 | -- (NSArray *)sortedLogFileInfos; | ||
| 141 | - | ||
| 142 | -// Private methods (only to be used by DDFileLogger) | ||
| 143 | - | ||
| 144 | -/** | ||
| 145 | - * Generates a new unique log file path, and creates the corresponding log file. | ||
| 146 | - **/ | ||
| 147 | -- (NSString *)createNewLogFile; | ||
| 148 | - | ||
| 149 | -@optional | ||
| 150 | - | ||
| 151 | -// Notifications from DDFileLogger | ||
| 152 | - | ||
| 153 | -/** | ||
| 154 | - * Called when a log file was archieved | ||
| 155 | - */ | ||
| 156 | -- (void)didArchiveLogFile:(NSString *)logFilePath; | ||
| 157 | - | ||
| 158 | -/** | ||
| 159 | - * Called when the roll action was executed and the log was archieved | ||
| 160 | - */ | ||
| 161 | -- (void)didRollAndArchiveLogFile:(NSString *)logFilePath; | ||
| 162 | - | ||
| 163 | -@end | ||
| 164 | - | ||
| 165 | -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
| 166 | -#pragma mark - | ||
| 167 | -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
| 168 | - | ||
| 169 | -/** | ||
| 170 | - * Default log file manager. | ||
| 171 | - * | ||
| 172 | - * All log files are placed inside the logsDirectory. | ||
| 173 | - * If a specific logsDirectory isn't specified, the default directory is used. | ||
| 174 | - * On Mac, this is in `~/Library/Logs/<Application Name>`. | ||
| 175 | - * On iPhone, this is in `~/Library/Caches/Logs`. | ||
| 176 | - * | ||
| 177 | - * Log files are named `"<bundle identifier> <date> <time>.log"` | ||
| 178 | - * Example: `com.organization.myapp 2013-12-03 17-14.log` | ||
| 179 | - * | ||
| 180 | - * Archived log files are automatically deleted according to the `maximumNumberOfLogFiles` property. | ||
| 181 | - **/ | ||
| 182 | -@interface DDLogFileManagerDefault : NSObject <DDLogFileManager> | ||
| 183 | - | ||
| 184 | -/** | ||
| 185 | - * Default initializer | ||
| 186 | - */ | ||
| 187 | -- (instancetype)init; | ||
| 188 | - | ||
| 189 | -/** | ||
| 190 | - * Designated initialized, requires the logs directory | ||
| 191 | - */ | ||
| 192 | -- (instancetype)initWithLogsDirectory:(NSString *)logsDirectory NS_DESIGNATED_INITIALIZER; | ||
| 193 | - | ||
| 194 | -#if TARGET_OS_IPHONE | ||
| 195 | -/* | ||
| 196 | - * Calling this constructor you can override the default "automagically" chosen NSFileProtection level. | ||
| 197 | - * Useful if you are writing a command line utility / CydiaSubstrate addon for iOS that has no NSBundle | ||
| 198 | - * or like SpringBoard no BackgroundModes key in the NSBundle: | ||
| 199 | - * iPhone:~ root# cycript -p SpringBoard | ||
| 200 | - * cy# [NSBundle mainBundle] | ||
| 201 | - * #"NSBundle </System/Library/CoreServices/SpringBoard.app> (loaded)" | ||
| 202 | - * cy# [[NSBundle mainBundle] objectForInfoDictionaryKey:@"UIBackgroundModes"]; | ||
| 203 | - * null | ||
| 204 | - * cy# | ||
| 205 | - **/ | ||
| 206 | -- (instancetype)initWithLogsDirectory:(NSString *)logsDirectory defaultFileProtectionLevel:(NSString *)fileProtectionLevel; | ||
| 207 | -#endif | ||
| 208 | - | ||
| 209 | -/* | ||
| 210 | - * Methods to override. | ||
| 211 | - * | ||
| 212 | - * Log files are named `"<bundle identifier> <date> <time>.log"` | ||
| 213 | - * Example: `com.organization.myapp 2013-12-03 17-14.log` | ||
| 214 | - * | ||
| 215 | - * If you wish to change default filename, you can override following two methods. | ||
| 216 | - * - `newLogFileName` method would be called on new logfile creation. | ||
| 217 | - * - `isLogFile:` method would be called to filter logfiles from all other files in logsDirectory. | ||
| 218 | - * You have to parse given filename and return YES if it is logFile. | ||
| 219 | - * | ||
| 220 | - * **NOTE** | ||
| 221 | - * `newLogFileName` returns filename. If appropriate file already exists, number would be added | ||
| 222 | - * to filename before extension. You have to handle this case in isLogFile: method. | ||
| 223 | - * | ||
| 224 | - * Example: | ||
| 225 | - * - newLogFileName returns `"com.organization.myapp 2013-12-03.log"`, | ||
| 226 | - * file `"com.organization.myapp 2013-12-03.log"` would be created. | ||
| 227 | - * - after some time `"com.organization.myapp 2013-12-03.log"` is archived | ||
| 228 | - * - newLogFileName again returns `"com.organization.myapp 2013-12-03.log"`, | ||
| 229 | - * file `"com.organization.myapp 2013-12-03 2.log"` would be created. | ||
| 230 | - * - after some time `"com.organization.myapp 2013-12-03 1.log"` is archived | ||
| 231 | - * - newLogFileName again returns `"com.organization.myapp 2013-12-03.log"`, | ||
| 232 | - * file `"com.organization.myapp 2013-12-03 3.log"` would be created. | ||
| 233 | - **/ | ||
| 234 | - | ||
| 235 | -/** | ||
| 236 | - * Generates log file name with default format `"<bundle identifier> <date> <time>.log"` | ||
| 237 | - * Example: `MobileSafari 2013-12-03 17-14.log` | ||
| 238 | - * | ||
| 239 | - * You can change it by overriding `newLogFileName` and `isLogFile:` methods. | ||
| 240 | - **/ | ||
| 241 | -@property (readonly, copy) NSString *newLogFileName; | ||
| 242 | - | ||
| 243 | -/** | ||
| 244 | - * Default log file name is `"<bundle identifier> <date> <time>.log"`. | ||
| 245 | - * Example: `MobileSafari 2013-12-03 17-14.log` | ||
| 246 | - * | ||
| 247 | - * You can change it by overriding `newLogFileName` and `isLogFile:` methods. | ||
| 248 | - **/ | ||
| 249 | -- (BOOL)isLogFile:(NSString *)fileName; | ||
| 250 | - | ||
| 251 | -/* Inherited from DDLogFileManager protocol: | ||
| 252 | - | ||
| 253 | - @property (readwrite, assign, atomic) NSUInteger maximumNumberOfLogFiles; | ||
| 254 | - @property (readwrite, assign, atomic) NSUInteger logFilesDiskQuota; | ||
| 255 | - | ||
| 256 | - - (NSString *)logsDirectory; | ||
| 257 | - | ||
| 258 | - - (NSArray *)unsortedLogFilePaths; | ||
| 259 | - - (NSArray *)unsortedLogFileNames; | ||
| 260 | - - (NSArray *)unsortedLogFileInfos; | ||
| 261 | - | ||
| 262 | - - (NSArray *)sortedLogFilePaths; | ||
| 263 | - - (NSArray *)sortedLogFileNames; | ||
| 264 | - - (NSArray *)sortedLogFileInfos; | ||
| 265 | - | ||
| 266 | - */ | ||
| 267 | - | ||
| 268 | -@end | ||
| 269 | - | ||
| 270 | -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
| 271 | -#pragma mark - | ||
| 272 | -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
| 273 | - | ||
| 274 | -/** | ||
| 275 | - * Most users will want file log messages to be prepended with the date and time. | ||
| 276 | - * Rather than forcing the majority of users to write their own formatter, | ||
| 277 | - * we will supply a logical default formatter. | ||
| 278 | - * Users can easily replace this formatter with their own by invoking the `setLogFormatter:` method. | ||
| 279 | - * It can also be removed by calling `setLogFormatter:`, and passing a nil parameter. | ||
| 280 | - * | ||
| 281 | - * In addition to the convenience of having a logical default formatter, | ||
| 282 | - * it will also provide a template that makes it easy for developers to copy and change. | ||
| 283 | - **/ | ||
| 284 | -@interface DDLogFileFormatterDefault : NSObject <DDLogFormatter> | ||
| 285 | - | ||
| 286 | -/** | ||
| 287 | - * Default initializer | ||
| 288 | - */ | ||
| 289 | -- (instancetype)init; | ||
| 290 | - | ||
| 291 | -/** | ||
| 292 | - * Designated initializer, requires a date formatter | ||
| 293 | - */ | ||
| 294 | -- (instancetype)initWithDateFormatter:(NSDateFormatter *)dateFormatter NS_DESIGNATED_INITIALIZER; | ||
| 295 | - | ||
| 296 | -@end | ||
| 297 | - | ||
| 298 | -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
| 299 | -#pragma mark - | ||
| 300 | -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
| 301 | - | ||
| 302 | -/** | ||
| 303 | - * The standard implementation for a file logger | ||
| 304 | - */ | ||
| 305 | -@interface DDFileLogger : DDAbstractLogger <DDLogger> | ||
| 306 | - | ||
| 307 | -/** | ||
| 308 | - * Default initializer | ||
| 309 | - */ | ||
| 310 | -- (instancetype)init; | ||
| 311 | - | ||
| 312 | -/** | ||
| 313 | - * Designated initializer, requires a `DDLogFileManager` instance | ||
| 314 | - */ | ||
| 315 | -- (instancetype)initWithLogFileManager:(id <DDLogFileManager>)logFileManager NS_DESIGNATED_INITIALIZER; | ||
| 316 | - | ||
| 317 | -/** | ||
| 318 | - * Log File Rolling: | ||
| 319 | - * | ||
| 320 | - * `maximumFileSize`: | ||
| 321 | - * The approximate maximum size to allow log files to grow. | ||
| 322 | - * If a log file is larger than this value after a log statement is appended, | ||
| 323 | - * then the log file is rolled. | ||
| 324 | - * | ||
| 325 | - * `rollingFrequency` | ||
| 326 | - * How often to roll the log file. | ||
| 327 | - * The frequency is given as an `NSTimeInterval`, which is a double that specifies the interval in seconds. | ||
| 328 | - * Once the log file gets to be this old, it is rolled. | ||
| 329 | - * | ||
| 330 | - * Both the `maximumFileSize` and the `rollingFrequency` are used to manage rolling. | ||
| 331 | - * Whichever occurs first will cause the log file to be rolled. | ||
| 332 | - * | ||
| 333 | - * For example: | ||
| 334 | - * The `rollingFrequency` is 24 hours, | ||
| 335 | - * but the log file surpasses the `maximumFileSize` after only 20 hours. | ||
| 336 | - * The log file will be rolled at that 20 hour mark. | ||
| 337 | - * A new log file will be created, and the 24 hour timer will be restarted. | ||
| 338 | - * | ||
| 339 | - * You may optionally disable rolling due to filesize by setting `maximumFileSize` to zero. | ||
| 340 | - * If you do so, rolling is based solely on `rollingFrequency`. | ||
| 341 | - * | ||
| 342 | - * You may optionally disable rolling due to time by setting `rollingFrequency` to zero (or any non-positive number). | ||
| 343 | - * If you do so, rolling is based solely on `maximumFileSize`. | ||
| 344 | - * | ||
| 345 | - * If you disable both `maximumFileSize` and `rollingFrequency`, then the log file won't ever be rolled. | ||
| 346 | - * This is strongly discouraged. | ||
| 347 | - **/ | ||
| 348 | -@property (readwrite, assign) unsigned long long maximumFileSize; | ||
| 349 | - | ||
| 350 | -/** | ||
| 351 | - * See description for `maximumFileSize` | ||
| 352 | - */ | ||
| 353 | -@property (readwrite, assign) NSTimeInterval rollingFrequency; | ||
| 354 | - | ||
| 355 | -/** | ||
| 356 | - * See description for `maximumFileSize` | ||
| 357 | - */ | ||
| 358 | -@property (readwrite, assign, atomic) BOOL doNotReuseLogFiles; | ||
| 359 | - | ||
| 360 | -/** | ||
| 361 | - * The DDLogFileManager instance can be used to retrieve the list of log files, | ||
| 362 | - * and configure the maximum number of archived log files to keep. | ||
| 363 | - * | ||
| 364 | - * @see DDLogFileManager.maximumNumberOfLogFiles | ||
| 365 | - **/ | ||
| 366 | -@property (strong, nonatomic, readonly) id <DDLogFileManager> logFileManager; | ||
| 367 | - | ||
| 368 | -/** | ||
| 369 | - * When using a custom formatter you can set the `logMessage` method not to append | ||
| 370 | - * `\n` character after each output. This allows for some greater flexibility with | ||
| 371 | - * custom formatters. Default value is YES. | ||
| 372 | - **/ | ||
| 373 | -@property (nonatomic, readwrite, assign) BOOL automaticallyAppendNewlineForCustomFormatters; | ||
| 374 | - | ||
| 375 | -/** | ||
| 376 | - * You can optionally force the current log file to be rolled with this method. | ||
| 377 | - * CompletionBlock will be called on main queue. | ||
| 378 | - */ | ||
| 379 | -- (void)rollLogFileWithCompletionBlock:(void (^)())completionBlock; | ||
| 380 | - | ||
| 381 | -/** | ||
| 382 | - * Method is deprecated. | ||
| 383 | - * @deprecated Use `rollLogFileWithCompletionBlock:` method instead. | ||
| 384 | - */ | ||
| 385 | -- (void)rollLogFile __attribute((deprecated)); | ||
| 386 | - | ||
| 387 | -// Inherited from DDAbstractLogger | ||
| 388 | - | ||
| 389 | -// - (id <DDLogFormatter>)logFormatter; | ||
| 390 | -// - (void)setLogFormatter:(id <DDLogFormatter>)formatter; | ||
| 391 | - | ||
| 392 | -/** | ||
| 393 | - * Returns the log file that should be used. | ||
| 394 | - * If there is an existing log file that is suitable, | ||
| 395 | - * within the constraints of `maximumFileSize` and `rollingFrequency`, then it is returned. | ||
| 396 | - * | ||
| 397 | - * Otherwise a new file is created and returned. | ||
| 398 | - **/ | ||
| 399 | -- (DDLogFileInfo *)currentLogFileInfo; | ||
| 400 | - | ||
| 401 | -@end | ||
| 402 | - | ||
| 403 | -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
| 404 | -#pragma mark - | ||
| 405 | -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
| 406 | - | ||
| 407 | -/** | ||
| 408 | - * `DDLogFileInfo` is a simple class that provides access to various file attributes. | ||
| 409 | - * It provides good performance as it only fetches the information if requested, | ||
| 410 | - * and it caches the information to prevent duplicate fetches. | ||
| 411 | - * | ||
| 412 | - * It was designed to provide quick snapshots of the current state of log files, | ||
| 413 | - * and to help sort log files in an array. | ||
| 414 | - * | ||
| 415 | - * This class does not monitor the files, or update it's cached attribute values if the file changes on disk. | ||
| 416 | - * This is not what the class was designed for. | ||
| 417 | - * | ||
| 418 | - * If you absolutely must get updated values, | ||
| 419 | - * you can invoke the reset method which will clear the cache. | ||
| 420 | - **/ | ||
| 421 | -@interface DDLogFileInfo : NSObject | ||
| 422 | - | ||
| 423 | -@property (strong, nonatomic, readonly) NSString *filePath; | ||
| 424 | -@property (strong, nonatomic, readonly) NSString *fileName; | ||
| 425 | - | ||
| 426 | -@property (strong, nonatomic, readonly) NSDictionary *fileAttributes; | ||
| 427 | - | ||
| 428 | -@property (strong, nonatomic, readonly) NSDate *creationDate; | ||
| 429 | -@property (strong, nonatomic, readonly) NSDate *modificationDate; | ||
| 430 | - | ||
| 431 | -@property (nonatomic, readonly) unsigned long long fileSize; | ||
| 432 | - | ||
| 433 | -@property (nonatomic, readonly) NSTimeInterval age; | ||
| 434 | - | ||
| 435 | -@property (nonatomic, readwrite) BOOL isArchived; | ||
| 436 | - | ||
| 437 | -+ (instancetype)logFileWithPath:(NSString *)filePath; | ||
| 438 | - | ||
| 439 | -- (instancetype)init NS_UNAVAILABLE; | ||
| 440 | -- (instancetype)initWithFilePath:(NSString *)filePath NS_DESIGNATED_INITIALIZER; | ||
| 441 | - | ||
| 442 | -- (void)reset; | ||
| 443 | -- (void)renameFile:(NSString *)newFileName; | ||
| 444 | - | ||
| 445 | -#if TARGET_IPHONE_SIMULATOR | ||
| 446 | - | ||
| 447 | -// So here's the situation. | ||
| 448 | -// Extended attributes are perfect for what we're trying to do here (marking files as archived). | ||
| 449 | -// This is exactly what extended attributes were designed for. | ||
| 450 | -// | ||
| 451 | -// But Apple screws us over on the simulator. | ||
| 452 | -// Everytime you build-and-go, they copy the application into a new folder on the hard drive, | ||
| 453 | -// and as part of the process they strip extended attributes from our log files. | ||
| 454 | -// Normally, a copy of a file preserves extended attributes. | ||
| 455 | -// So obviously Apple has gone to great lengths to piss us off. | ||
| 456 | -// | ||
| 457 | -// Thus we use a slightly different tactic for marking log files as archived in the simulator. | ||
| 458 | -// That way it "just works" and there's no confusion when testing. | ||
| 459 | -// | ||
| 460 | -// The difference in method names is indicative of the difference in functionality. | ||
| 461 | -// On the simulator we add an attribute by appending a filename extension. | ||
| 462 | -// | ||
| 463 | -// For example: | ||
| 464 | -// "mylog.txt" -> "mylog.archived.txt" | ||
| 465 | -// "mylog" -> "mylog.archived" | ||
| 466 | - | ||
| 467 | -- (BOOL)hasExtensionAttributeWithName:(NSString *)attrName; | ||
| 468 | - | ||
| 469 | -- (void)addExtensionAttributeWithName:(NSString *)attrName; | ||
| 470 | -- (void)removeExtensionAttributeWithName:(NSString *)attrName; | ||
| 471 | - | ||
| 472 | -#else /* if TARGET_IPHONE_SIMULATOR */ | ||
| 473 | - | ||
| 474 | -// Normal use of extended attributes used everywhere else, | ||
| 475 | -// such as on Macs and on iPhone devices. | ||
| 476 | - | ||
| 477 | -- (BOOL)hasExtendedAttributeWithName:(NSString *)attrName; | ||
| 478 | - | ||
| 479 | -- (void)addExtendedAttributeWithName:(NSString *)attrName; | ||
| 480 | -- (void)removeExtendedAttributeWithName:(NSString *)attrName; | ||
| 481 | - | ||
| 482 | -#endif /* if TARGET_IPHONE_SIMULATOR */ | ||
| 483 | - | ||
| 484 | -- (NSComparisonResult)reverseCompareByCreationDate:(DDLogFileInfo *)another; | ||
| 485 | -- (NSComparisonResult)reverseCompareByModificationDate:(DDLogFileInfo *)another; | ||
| 486 | - | ||
| 487 | -@end |
CNLiveXMPPManagerDemo/CocoaLumberjack.framework/Headers/DDLegacyMacros.h deleted
100644 → 0
| 1 | -// Software License Agreement (BSD License) | ||
| 2 | -// | ||
| 3 | -// Copyright (c) 2010-2016, Deusty, LLC | ||
| 4 | -// All rights reserved. | ||
| 5 | -// | ||
| 6 | -// Redistribution and use of this software in source and binary forms, | ||
| 7 | -// with or without modification, are permitted provided that the following conditions are met: | ||
| 8 | -// | ||
| 9 | -// * Redistributions of source code must retain the above copyright notice, | ||
| 10 | -// this list of conditions and the following disclaimer. | ||
| 11 | -// | ||
| 12 | -// * Neither the name of Deusty nor the names of its contributors may be used | ||
| 13 | -// to endorse or promote products derived from this software without specific | ||
| 14 | -// prior written permission of Deusty, LLC. | ||
| 15 | - | ||
| 16 | -/** | ||
| 17 | - * Legacy macros used for 1.9.x backwards compatibility. | ||
| 18 | - * | ||
| 19 | - * Imported by default when importing a DDLog.h directly and DD_LEGACY_MACROS is not defined and set to 0. | ||
| 20 | - **/ | ||
| 21 | -#if DD_LEGACY_MACROS | ||
| 22 | - | ||
| 23 | -#warning CocoaLumberjack 1.9.x legacy macros enabled. \ | ||
| 24 | -Disable legacy macros by importing CocoaLumberjack.h or DDLogMacros.h instead of DDLog.h or add `#define DD_LEGACY_MACROS 0` before importing DDLog.h. | ||
| 25 | - | ||
| 26 | -#ifndef LOG_LEVEL_DEF | ||
| 27 | - #define LOG_LEVEL_DEF ddLogLevel | ||
| 28 | -#endif | ||
| 29 | - | ||
| 30 | -#define LOG_FLAG_ERROR DDLogFlagError | ||
| 31 | -#define LOG_FLAG_WARN DDLogFlagWarning | ||
| 32 | -#define LOG_FLAG_INFO DDLogFlagInfo | ||
| 33 | -#define LOG_FLAG_DEBUG DDLogFlagDebug | ||
| 34 | -#define LOG_FLAG_VERBOSE DDLogFlagVerbose | ||
| 35 | - | ||
| 36 | -#define LOG_LEVEL_OFF DDLogLevelOff | ||
| 37 | -#define LOG_LEVEL_ERROR DDLogLevelError | ||
| 38 | -#define LOG_LEVEL_WARN DDLogLevelWarning | ||
| 39 | -#define LOG_LEVEL_INFO DDLogLevelInfo | ||
| 40 | -#define LOG_LEVEL_DEBUG DDLogLevelDebug | ||
| 41 | -#define LOG_LEVEL_VERBOSE DDLogLevelVerbose | ||
| 42 | -#define LOG_LEVEL_ALL DDLogLevelAll | ||
| 43 | - | ||
| 44 | -#define LOG_ASYNC_ENABLED YES | ||
| 45 | - | ||
| 46 | -#define LOG_ASYNC_ERROR ( NO && LOG_ASYNC_ENABLED) | ||
| 47 | -#define LOG_ASYNC_WARN (YES && LOG_ASYNC_ENABLED) | ||
| 48 | -#define LOG_ASYNC_INFO (YES && LOG_ASYNC_ENABLED) | ||
| 49 | -#define LOG_ASYNC_DEBUG (YES && LOG_ASYNC_ENABLED) | ||
| 50 | -#define LOG_ASYNC_VERBOSE (YES && LOG_ASYNC_ENABLED) | ||
| 51 | - | ||
| 52 | -#define LOG_MACRO(isAsynchronous, lvl, flg, ctx, atag, fnct, frmt, ...) \ | ||
| 53 | - [DDLog log : isAsynchronous \ | ||
| 54 | - level : lvl \ | ||
| 55 | - flag : flg \ | ||
| 56 | - context : ctx \ | ||
| 57 | - file : __FILE__ \ | ||
| 58 | - function : fnct \ | ||
| 59 | - line : __LINE__ \ | ||
| 60 | - tag : atag \ | ||
| 61 | - format : (frmt), ## __VA_ARGS__] | ||
| 62 | - | ||
| 63 | -#define LOG_MAYBE(async, lvl, flg, ctx, fnct, frmt, ...) \ | ||
| 64 | - do { if(lvl & flg) LOG_MACRO(async, lvl, flg, ctx, nil, fnct, frmt, ##__VA_ARGS__); } while(0) | ||
| 65 | - | ||
| 66 | -#define LOG_OBJC_MAYBE(async, lvl, flg, ctx, frmt, ...) \ | ||
| 67 | - LOG_MAYBE(async, lvl, flg, ctx, __PRETTY_FUNCTION__, frmt, ## __VA_ARGS__) | ||
| 68 | - | ||
| 69 | -#define DDLogError(frmt, ...) LOG_OBJC_MAYBE(LOG_ASYNC_ERROR, LOG_LEVEL_DEF, LOG_FLAG_ERROR, 0, frmt, ##__VA_ARGS__) | ||
| 70 | -#define DDLogWarn(frmt, ...) LOG_OBJC_MAYBE(LOG_ASYNC_WARN, LOG_LEVEL_DEF, LOG_FLAG_WARN, 0, frmt, ##__VA_ARGS__) | ||
| 71 | -#define DDLogInfo(frmt, ...) LOG_OBJC_MAYBE(LOG_ASYNC_INFO, LOG_LEVEL_DEF, LOG_FLAG_INFO, 0, frmt, ##__VA_ARGS__) | ||
| 72 | -#define DDLogDebug(frmt, ...) LOG_OBJC_MAYBE(LOG_ASYNC_DEBUG, LOG_LEVEL_DEF, LOG_FLAG_DEBUG, 0, frmt, ##__VA_ARGS__) | ||
| 73 | -#define DDLogVerbose(frmt, ...) LOG_OBJC_MAYBE(LOG_ASYNC_VERBOSE, LOG_LEVEL_DEF, LOG_FLAG_VERBOSE, 0, frmt, ##__VA_ARGS__) | ||
| 74 | - | ||
| 75 | -#endif |
CNLiveXMPPManagerDemo/CocoaLumberjack.framework/Headers/DDLog+LOGV.h deleted
100644 → 0
| 1 | -// Software License Agreement (BSD License) | ||
| 2 | -// | ||
| 3 | -// Copyright (c) 2010-2016, Deusty, LLC | ||
| 4 | -// All rights reserved. | ||
| 5 | -// | ||
| 6 | -// Redistribution and use of this software in source and binary forms, | ||
| 7 | -// with or without modification, are permitted provided that the following conditions are met: | ||
| 8 | -// | ||
| 9 | -// * Redistributions of source code must retain the above copyright notice, | ||
| 10 | -// this list of conditions and the following disclaimer. | ||
| 11 | -// | ||
| 12 | -// * Neither the name of Deusty nor the names of its contributors may be used | ||
| 13 | -// to endorse or promote products derived from this software without specific | ||
| 14 | -// prior written permission of Deusty, LLC. | ||
| 15 | - | ||
| 16 | -// Disable legacy macros | ||
| 17 | -#ifndef DD_LEGACY_MACROS | ||
| 18 | - #define DD_LEGACY_MACROS 0 | ||
| 19 | -#endif | ||
| 20 | - | ||
| 21 | -#import "DDLog.h" | ||
| 22 | - | ||
| 23 | -/** | ||
| 24 | - * The constant/variable/method responsible for controlling the current log level. | ||
| 25 | - **/ | ||
| 26 | -#ifndef LOG_LEVEL_DEF | ||
| 27 | - #define LOG_LEVEL_DEF ddLogLevel | ||
| 28 | -#endif | ||
| 29 | - | ||
| 30 | -/** | ||
| 31 | - * Whether async should be used by log messages, excluding error messages that are always sent sync. | ||
| 32 | - **/ | ||
| 33 | -#ifndef LOG_ASYNC_ENABLED | ||
| 34 | - #define LOG_ASYNC_ENABLED YES | ||
| 35 | -#endif | ||
| 36 | - | ||
| 37 | -/** | ||
| 38 | - * This is the single macro that all other macros below compile into. | ||
| 39 | - * This big multiline macro makes all the other macros easier to read. | ||
| 40 | - **/ | ||
| 41 | -#define LOGV_MACRO(isAsynchronous, lvl, flg, ctx, atag, fnct, frmt, avalist) \ | ||
| 42 | - [DDLog log : isAsynchronous \ | ||
| 43 | - level : lvl \ | ||
| 44 | - flag : flg \ | ||
| 45 | - context : ctx \ | ||
| 46 | - file : __FILE__ \ | ||
| 47 | - function : fnct \ | ||
| 48 | - line : __LINE__ \ | ||
| 49 | - tag : atag \ | ||
| 50 | - format : frmt \ | ||
| 51 | - args : avalist] | ||
| 52 | - | ||
| 53 | -/** | ||
| 54 | - * Define version of the macro that only execute if the log level is above the threshold. | ||
| 55 | - * The compiled versions essentially look like this: | ||
| 56 | - * | ||
| 57 | - * if (logFlagForThisLogMsg & ddLogLevel) { execute log message } | ||
| 58 | - * | ||
| 59 | - * When LOG_LEVEL_DEF is defined as ddLogLevel. | ||
| 60 | - * | ||
| 61 | - * As shown further below, Lumberjack actually uses a bitmask as opposed to primitive log levels. | ||
| 62 | - * This allows for a great amount of flexibility and some pretty advanced fine grained logging techniques. | ||
| 63 | - * | ||
| 64 | - * Note that when compiler optimizations are enabled (as they are for your release builds), | ||
| 65 | - * the log messages above your logging threshold will automatically be compiled out. | ||
| 66 | - * | ||
| 67 | - * (If the compiler sees LOG_LEVEL_DEF/ddLogLevel declared as a constant, the compiler simply checks to see | ||
| 68 | - * if the 'if' statement would execute, and if not it strips it from the binary.) | ||
| 69 | - * | ||
| 70 | - * We also define shorthand versions for asynchronous and synchronous logging. | ||
| 71 | - **/ | ||
| 72 | -#define LOGV_MAYBE(async, lvl, flg, ctx, tag, fnct, frmt, avalist) \ | ||
| 73 | - do { if(lvl & flg) LOGV_MACRO(async, lvl, flg, ctx, tag, fnct, frmt, avalist); } while(0) | ||
| 74 | - | ||
| 75 | -/** | ||
| 76 | - * Ready to use log macros with no context or tag. | ||
| 77 | - **/ | ||
| 78 | -#define DDLogVError(frmt, avalist) LOGV_MAYBE(NO, LOG_LEVEL_DEF, DDLogFlagError, 0, nil, __PRETTY_FUNCTION__, frmt, avalist) | ||
| 79 | -#define DDLogVWarn(frmt, avalist) LOGV_MAYBE(LOG_ASYNC_ENABLED, LOG_LEVEL_DEF, DDLogFlagWarning, 0, nil, __PRETTY_FUNCTION__, frmt, avalist) | ||
| 80 | -#define DDLogVInfo(frmt, avalist) LOGV_MAYBE(LOG_ASYNC_ENABLED, LOG_LEVEL_DEF, DDLogFlagInfo, 0, nil, __PRETTY_FUNCTION__, frmt, avalist) | ||
| 81 | -#define DDLogVDebug(frmt, avalist) LOGV_MAYBE(LOG_ASYNC_ENABLED, LOG_LEVEL_DEF, DDLogFlagDebug, 0, nil, __PRETTY_FUNCTION__, frmt, avalist) | ||
| 82 | -#define DDLogVVerbose(frmt, avalist) LOGV_MAYBE(LOG_ASYNC_ENABLED, LOG_LEVEL_DEF, DDLogFlagVerbose, 0, nil, __PRETTY_FUNCTION__, frmt, avalist) | ||
| 83 | - |