Commit 51c7d12d authored by Stefan van den Oord's avatar Stefan van den Oord

pod update:

* CocoaAsyncSocket 7.4.2 (was 7.4.1)
* Installing NetUtils 1.1.1 (was 1.0)
parent 1d3c5104
PODS:
- Base32 (1.0.2)
- CocoaAsyncSocket (7.4.1)
- CocoaAsyncSocket (7.4.2)
- IGDigest (1.1.2)
- lz4 (128)
- NetUtils (1.0)
- NetUtils (1.1.1)
- Nimble (2.0.0-rc.2)
- OpenSSL-Framework (1.0.201)
- Quick (0.5.1)
......@@ -22,10 +22,10 @@ DEPENDENCIES:
SPEC CHECKSUMS:
Base32: 4e6b6d6c344b48da363c5268f9c391d37893401f
CocoaAsyncSocket: 7cbf214b27f8e7f7574db6a3fd96352ffaed433d
CocoaAsyncSocket: f5783bdedd232d91b89769bc4b5a1580aed518ad
IGDigest: 066753c10f3f1b593b00037b9ee93dc96b9e7762
lz4: 5e066195ca751d552becaa026f8fe213ff738adf
NetUtils: a83e4d66bd9b62a7e8d09f71b1e7159c5f71b44f
NetUtils: 0384e14f009d8ebc8ba5d68ab6d0e6b62e5b2803
Nimble: e3cf5e73a491daf21c2bc88783dbfc55ce8b8e02
OpenSSL-Framework: f10c6aa8a92f69fca94303c3774b4773860a9690
Quick: 7426537a99e75076d6930c5b6da58006e4a9f38a
......
# CocoaAsyncSocket
[![Build Status](https://travis-ci.org/robbiehanson/CocoaAsyncSocket.svg?branch=master)](https://travis-ci.org/robbiehanson/CocoaAsyncSocket) [![Version Status](https://img.shields.io/cocoapods/v/CocoaAsyncSocket.svg?style=flat)](http://cocoadocs.org/docsets/CocoaAsyncSocket) [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) [![Platform](http://img.shields.io/cocoapods/p/CocoaAsyncSocket.svg?style=flat)](http://cocoapods.org/?q=CocoaAsyncSocket) [![license Public Domain](https://img.shields.io/badge/license-Public%20Domain-orange.svg?style=flat)](https://en.wikipedia.org/wiki/Public_domain)
CocoaAsyncSocket provides easy-to-use and powerful asynchronous socket libraries for Mac and iOS. The classes are described below.
## Installation
#### CocoaPods
Install using [CocoaPods](http://cocoapods.org) by adding this line to your Podfile:
````ruby
use_frameworks! # Add this if you are targeting iOS 8+ or using Swift
pod 'CocoaAsyncSocket'
````
#### Carthage
CocoaAsyncSocket is [Carthage](https://github.com/Carthage/Carthage) compatible. To include it, build your project with Carthage, then drag `Carthage/Build/iOS/CocoaAsyncSocket.framework` into your project.
#### Manual
You can also include it into your project by adding the source files directly, but you should probably be using a dependency manager to keep up to date.
### Importing
Using Objective-C:
```obj-c
@import CocoaAsyncSocket; // When using iOS 8+ frameworks
// OR
#import "CocoaAsyncSocket.h" // When not using frameworks, targeting iOS 7 or below
```
Using Swift:
```swift
import CocoaAsyncSocket
```
## TCP
**GCDAsyncSocket** and **AsyncSocket** are TCP/IP socket networking libraries. Here are the key features available in both:
......
//
// CocoaAsyncSocket.h
// CocoaAsyncSocket
//
// Created by Derek Clarkson on 10/08/2015.
// Copyright © 2015 Robbie Hanson. All rights reserved.
//
@import Foundation;
//! Project version number for CocoaAsyncSocket.
FOUNDATION_EXPORT double cocoaAsyncSocketVersionNumber;
//! Project version string for CocoaAsyncSocket.
FOUNDATION_EXPORT const unsigned char cocoaAsyncSocketVersionString[];
#import <CocoaAsyncSocket/AsyncSocket.h>
#import <CocoaAsyncSocket/AsyncUdpSocket.h>
#import <CocoaAsyncSocket/GCDAsyncSocket.h>
#import <CocoaAsyncSocket/GCDAsyncUdpSocket.h>
......@@ -46,8 +46,7 @@ extern NSString *const GCDAsyncSocketSSLDiffieHellmanParameters;
#define GCDAsyncSocketLoggingContext 65535
enum GCDAsyncSocketError
{
typedef NS_ENUM(NSInteger, GCDAsyncSocketError) {
GCDAsyncSocketNoError = 0, // Never used
GCDAsyncSocketBadConfigError, // Invalid configuration
GCDAsyncSocketBadParamError, // Invalid parameter was passed
......@@ -58,7 +57,6 @@ enum GCDAsyncSocketError
GCDAsyncSocketClosedError, // The remote peer closed the connection
GCDAsyncSocketOtherError, // Description provided in userInfo
};
typedef enum GCDAsyncSocketError GCDAsyncSocketError;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#pragma mark -
......
......@@ -903,6 +903,7 @@ enum GCDAsyncSocketConfig
GCDAsyncSocketPreBuffer *sslPreBuffer;
size_t sslWriteCachedLength;
OSStatus sslErrCode;
OSStatus lastSSLHandshakeError;
void *IsOnSocketQueueOrTargetQueueKey;
......@@ -2571,7 +2572,7 @@ enum GCDAsyncSocketConfig
#endif
[sslPreBuffer reset];
sslErrCode = noErr;
sslErrCode = lastSSLHandshakeError = noErr;
if (sslContext)
{
......@@ -2668,6 +2669,7 @@ enum GCDAsyncSocketConfig
// Clear stored socket info and all flags (config remains as is)
socketFDBytesAvailable = 0;
flags = 0;
sslWriteCachedLength = 0;
if (shouldCallDelegate)
{
......@@ -4225,7 +4227,7 @@ enum GCDAsyncSocketConfig
if (flags & kStartingWriteTLS)
{
if ([self usingSecureTransportForTLS])
if ([self usingSecureTransportForTLS] && lastSSLHandshakeError == errSSLWouldBlock)
{
// We are in the process of a SSL Handshake.
// We were waiting for incoming data which has just arrived.
......@@ -5313,7 +5315,7 @@ enum GCDAsyncSocketConfig
if (flags & kStartingReadTLS)
{
if ([self usingSecureTransportForTLS])
if ([self usingSecureTransportForTLS] && lastSSLHandshakeError == errSSLWouldBlock)
{
// We are in the process of a SSL Handshake.
// We were waiting for available space in the socket's internal OS buffer to continue writing.
......@@ -6521,7 +6523,7 @@ static OSStatus SSLWriteFunction(SSLConnectionRef connection, const void *data,
[sslPreBuffer didWrite:preBufferLength];
}
sslErrCode = noErr;
sslErrCode = lastSSLHandshakeError = noErr;
// Start the SSL Handshake process
......@@ -6540,6 +6542,7 @@ static OSStatus SSLWriteFunction(SSLConnectionRef connection, const void *data,
// Otherwise, the return value indicates an error code.
OSStatus status = SSLHandshake(sslContext);
lastSSLHandshakeError = status;
if (status == noErr)
{
......@@ -6662,6 +6665,7 @@ static OSStatus SSLWriteFunction(SSLConnectionRef connection, const void *data,
if (shouldTrust)
{
NSAssert(lastSSLHandshakeError == errSSLPeerAuthCompleted, @"ssl_shouldTrustPeer called when last error is %d and not errSSLPeerAuthCompleted", (int)lastSSLHandshakeError);
[self ssl_continueSSLHandshake];
}
else
......
......@@ -19,8 +19,7 @@ extern NSString *const GCDAsyncUdpSocketErrorDomain;
extern NSString *const GCDAsyncUdpSocketQueueName;
extern NSString *const GCDAsyncUdpSocketThreadName;
enum GCDAsyncUdpSocketError
{
typedef NS_ENUM(NSInteger, GCDAsyncUdpSocketError) {
GCDAsyncUdpSocketNoError = 0, // Never used
GCDAsyncUdpSocketBadConfigError, // Invalid configuration
GCDAsyncUdpSocketBadParamError, // Invalid parameter was passed
......@@ -28,7 +27,6 @@ enum GCDAsyncUdpSocketError
GCDAsyncUdpSocketClosedError, // The socket was closed
GCDAsyncUdpSocketOtherError, // Description provided in userInfo
};
typedef enum GCDAsyncUdpSocketError GCDAsyncUdpSocketError;
/**
* You may optionally set a receive filter for the socket.
......
......@@ -1486,13 +1486,6 @@ enum GCDAsyncUdpSocketConfig
if (strcmp(cursor->ifa_name, iface) == 0)
{
// Name match
///// SVDO
char ip[INET6_ADDRSTRLEN];
const char *conversion;
conversion = inet_ntop(AF_INET6, &addr->sin6_addr, ip, sizeof(ip));
///// END SVDO
struct sockaddr_in6 nativeAddr6 = *addr;
nativeAddr6.sin6_port = htons(port);
......@@ -3925,7 +3918,6 @@ enum GCDAsyncUdpSocketConfig
{
result = sendto(socket6FD, buffer, length, 0, dst, dstSize);
LogVerbose(@"sendto(socket6FD) = %d", result);
NSLog(@"sendto(socket6FD) = %d: %s", result, strerror(errno));
}
}
......@@ -4301,7 +4293,9 @@ enum GCDAsyncUdpSocketConfig
struct sockaddr_in sockaddr4;
socklen_t sockaddr4len = sizeof(sockaddr4);
size_t bufSize = MIN(max4ReceiveSize, socket4FDBytesAvailable);
// #222: GCD does not necessarily return the size of an entire UDP packet
// from dispatch_source_get_data(), so we must use the maximum packet size.
size_t bufSize = max4ReceiveSize;
void *buf = malloc(bufSize);
result = recvfrom(socket4FD, buf, bufSize, 0, (struct sockaddr *)&sockaddr4, &sockaddr4len);
......@@ -4336,7 +4330,9 @@ enum GCDAsyncUdpSocketConfig
struct sockaddr_in6 sockaddr6;
socklen_t sockaddr6len = sizeof(sockaddr6);
size_t bufSize = MIN(max6ReceiveSize, socket6FDBytesAvailable);
// #222: GCD does not necessarily return the size of an entire UDP packet
// from dispatch_source_get_data(), so we must use the maximum packet size.
size_t bufSize = max6ReceiveSize;
void *buf = malloc(bufSize);
result = recvfrom(socket6FD, buf, bufSize, 0, (struct sockaddr *)&sockaddr6, &sockaddr6len);
......
......@@ -17,8 +17,7 @@
extern NSString *const AsyncSocketException;
extern NSString *const AsyncSocketErrorDomain;
enum AsyncSocketError
{
typedef NS_ENUM(NSInteger, AsyncSocketError) {
AsyncSocketCFSocketError = kCFSocketError, // From CFSocketError enum.
AsyncSocketNoError = 0, // Never used.
AsyncSocketCanceledError, // onSocketWillConnect: returned NO.
......@@ -27,7 +26,6 @@ enum AsyncSocketError
AsyncSocketReadTimeoutError,
AsyncSocketWriteTimeoutError
};
typedef enum AsyncSocketError AsyncSocketError;
@protocol AsyncSocketDelegate
@optional
......
......@@ -16,8 +16,7 @@
extern NSString *const AsyncUdpSocketException;
extern NSString *const AsyncUdpSocketErrorDomain;
enum AsyncUdpSocketError
{
typedef NS_ENUM(NSInteger, AsyncUdpSocketError) {
AsyncUdpSocketCFSocketError = kCFSocketError, // From CFSocketError enum
AsyncUdpSocketNoError = 0, // Never used
AsyncUdpSocketBadParameter, // Used if given a bad parameter (such as an improper address)
......@@ -26,7 +25,6 @@ enum AsyncUdpSocketError
AsyncUdpSocketSendTimeoutError,
AsyncUdpSocketReceiveTimeoutError
};
typedef enum AsyncUdpSocketError AsyncUdpSocketError;
@interface AsyncUdpSocket : NSObject
{
......
../../../CocoaAsyncSocket/RunLoop/AsyncSocket.h
\ No newline at end of file
../../../CocoaAsyncSocket/Source/RunLoop/AsyncSocket.h
\ No newline at end of file
../../../CocoaAsyncSocket/RunLoop/AsyncUdpSocket.h
\ No newline at end of file
../../../CocoaAsyncSocket/Source/RunLoop/AsyncUdpSocket.h
\ No newline at end of file
../../../CocoaAsyncSocket/Source/CocoaAsyncSocket.h
\ No newline at end of file
../../../CocoaAsyncSocket/GCD/GCDAsyncSocket.h
\ No newline at end of file
../../../CocoaAsyncSocket/Source/GCD/GCDAsyncSocket.h
\ No newline at end of file
../../../CocoaAsyncSocket/GCD/GCDAsyncUdpSocket.h
\ No newline at end of file
../../../CocoaAsyncSocket/Source/GCD/GCDAsyncUdpSocket.h
\ No newline at end of file
PODS:
- Base32 (1.0.2)
- CocoaAsyncSocket (7.4.1)
- CocoaAsyncSocket (7.4.2)
- IGDigest (1.1.2)
- lz4 (128)
- NetUtils (1.0)
- NetUtils (1.1.1)
- Nimble (2.0.0-rc.2)
- OpenSSL-Framework (1.0.201)
- Quick (0.5.1)
......@@ -22,10 +22,10 @@ DEPENDENCIES:
SPEC CHECKSUMS:
Base32: 4e6b6d6c344b48da363c5268f9c391d37893401f
CocoaAsyncSocket: 7cbf214b27f8e7f7574db6a3fd96352ffaed433d
CocoaAsyncSocket: f5783bdedd232d91b89769bc4b5a1580aed518ad
IGDigest: 066753c10f3f1b593b00037b9ee93dc96b9e7762
lz4: 5e066195ca751d552becaa026f8fe213ff738adf
NetUtils: a83e4d66bd9b62a7e8d09f71b1e7159c5f71b44f
NetUtils: 0384e14f009d8ebc8ba5d68ab6d0e6b62e5b2803
Nimble: e3cf5e73a491daf21c2bc88783dbfc55ce8b8e02
OpenSSL-Framework: f10c6aa8a92f69fca94303c3774b4773860a9690
Quick: 7426537a99e75076d6930c5b6da58006e4a9f38a
......
......@@ -3,7 +3,7 @@
import Foundation
import ifaddrs
public class Interface {
public class Interface : CustomStringConvertible, CustomDebugStringConvertible {
public enum Family : Int {
case ipv4, ipv6, other
......@@ -126,4 +126,16 @@ public class Interface {
private let up : Bool
private let loopback : Bool
private let multicastSupported : Bool
public var description: String { get { return getName() } }
public var debugDescription: String { get {
var s = "Interface name:\(getName()) family:\(getFamily())"
if let ip = getAddress() {
s += " ip:\(ip)"
}
s += isUp() ? " (up)" : " (down)"
s += isRunning() ? " (running)" : "(not running)"
return s
} }
}
NetUtils for Swift
==================
Swift library that simplifies getting information about your network interfaces and their properties, both for iOS and OS X.
This library is a wrapper around the BSD APIs like getifaddrs, to make it easy to use them from Swift.
Recommended way of integrating this library is using CocoaPods: https://cocoapods.org/pods/NetUtils.
module ifaddrs [system] [extern_c] {
header "/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include/ifaddrs.h"
header "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include/ifaddrs.h"
export *
}
module ifaddrs [system] [extern_c] {
header "/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/include/ifaddrs.h"
header "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/include/ifaddrs.h"
export *
}
module ifaddrs [system] [extern_c] {
header "/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/ifaddrs.h"
header "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/ifaddrs.h"
export *
}
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -4,6 +4,7 @@
#import "GCDAsyncUdpSocket.h"
#import "AsyncSocket.h"
#import "AsyncUdpSocket.h"
#import "CocoaAsyncSocket.h"
FOUNDATION_EXPORT double CocoaAsyncSocketVersionNumber;
FOUNDATION_EXPORT const unsigned char CocoaAsyncSocketVersionString[];
......
......@@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>7.4.1</string>
<string>7.4.2</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
......
......@@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<string>1.1.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment