-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9d0b2cb
commit 71d70f0
Showing
8 changed files
with
427 additions
and
5 deletions.
There are no files selected for viewing
91 changes: 91 additions & 0 deletions
91
Apps/Criollo macOS App.xcodeproj/xcshareddata/xcschemes/Criollo macOS App.xcscheme
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<Scheme | ||
LastUpgradeVersion = "1010" | ||
version = "1.3"> | ||
<BuildAction | ||
parallelizeBuildables = "YES" | ||
buildImplicitDependencies = "YES"> | ||
<BuildActionEntries> | ||
<BuildActionEntry | ||
buildForTesting = "YES" | ||
buildForRunning = "YES" | ||
buildForProfiling = "YES" | ||
buildForArchiving = "YES" | ||
buildForAnalyzing = "YES"> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "ADC1A5BF1CA30F49009A4A19" | ||
BuildableName = "Criollo macOS App.app" | ||
BlueprintName = "Criollo macOS App" | ||
ReferencedContainer = "container:Criollo macOS App.xcodeproj"> | ||
</BuildableReference> | ||
</BuildActionEntry> | ||
</BuildActionEntries> | ||
</BuildAction> | ||
<TestAction | ||
buildConfiguration = "Debug" | ||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | ||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | ||
shouldUseLaunchSchemeArgsEnv = "YES"> | ||
<Testables> | ||
</Testables> | ||
<MacroExpansion> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "ADC1A5BF1CA30F49009A4A19" | ||
BuildableName = "Criollo macOS App.app" | ||
BlueprintName = "Criollo macOS App" | ||
ReferencedContainer = "container:Criollo macOS App.xcodeproj"> | ||
</BuildableReference> | ||
</MacroExpansion> | ||
<AdditionalOptions> | ||
</AdditionalOptions> | ||
</TestAction> | ||
<LaunchAction | ||
buildConfiguration = "Debug" | ||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | ||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | ||
launchStyle = "0" | ||
useCustomWorkingDirectory = "NO" | ||
ignoresPersistentStateOnLaunch = "NO" | ||
debugDocumentVersioning = "YES" | ||
debugServiceExtension = "internal" | ||
allowLocationSimulation = "YES"> | ||
<BuildableProductRunnable | ||
runnableDebuggingMode = "0"> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "ADC1A5BF1CA30F49009A4A19" | ||
BuildableName = "Criollo macOS App.app" | ||
BlueprintName = "Criollo macOS App" | ||
ReferencedContainer = "container:Criollo macOS App.xcodeproj"> | ||
</BuildableReference> | ||
</BuildableProductRunnable> | ||
<AdditionalOptions> | ||
</AdditionalOptions> | ||
</LaunchAction> | ||
<ProfileAction | ||
buildConfiguration = "Release" | ||
shouldUseLaunchSchemeArgsEnv = "YES" | ||
savedToolIdentifier = "" | ||
useCustomWorkingDirectory = "NO" | ||
debugDocumentVersioning = "YES"> | ||
<BuildableProductRunnable | ||
runnableDebuggingMode = "0"> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "ADC1A5BF1CA30F49009A4A19" | ||
BuildableName = "Criollo macOS App.app" | ||
BlueprintName = "Criollo macOS App" | ||
ReferencedContainer = "container:Criollo macOS App.xcodeproj"> | ||
</BuildableReference> | ||
</BuildableProductRunnable> | ||
</ProfileAction> | ||
<AnalyzeAction | ||
buildConfiguration = "Debug"> | ||
</AnalyzeAction> | ||
<ArchiveAction | ||
buildConfiguration = "Release" | ||
revealArchiveInOrganizer = "YES"> | ||
</ArchiveAction> | ||
</Scheme> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// | ||
// CRSocket.h | ||
// Criollo macOS | ||
// | ||
// Created by Cătălin Stan on 19/12/2018. | ||
// Copyright © 2018 Cătălin Stan. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
|
||
#define CRSocketErrorDomain @"CRSocketErrorDomain" | ||
|
||
#define CRUnableToResolveAddress 5001 | ||
|
||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
@class CRSocket; | ||
|
||
@protocol CRSocketDelegate <NSObject> | ||
|
||
/** | ||
Called when a listening socket has accepted a new connection. | ||
@param sock The listening `CRSocket` object accepting the connection. | ||
@param fd The file descriptor of the multiplexed socket | ||
@param sa The `struct sockaddr` that is filled in with the address of the connecting entity, as known to the communications layer. | ||
@param len Contains the actual length (in bytes) of the address returned. | ||
@see `accept(2)` | ||
*/ | ||
- (void)socket:(CRSocket *)sock didAccept:(int)fd addr:(struct sockaddr *)sa len:(socklen_t)len; | ||
|
||
|
||
/** | ||
Called when data has become available on a multiplexed descriptor of a scoket. | ||
@param sock The listening `CRSocket` object owning the connection. | ||
@param buf A pointer to the buffer conaining the data. | ||
@param len The length (in bytes) of the data read. | ||
@param fd The file descriptor of the multiplexed socket that has read the data. | ||
*/ | ||
- (void)socket:(CRSocket *)sock didReadData:(const void *)buf size:(size_t)len descriptor:(int)fd; | ||
|
||
@end | ||
|
||
@interface CRSocket : NSObject | ||
|
||
@property (nonatomic, strong, readonly) id<CRSocketDelegate> delegate; | ||
|
||
- (instancetype)initWithDelegate:(id<CRSocketDelegate> _Nullable)delegate delegateQueue:(dispatch_queue_t _Nullable)delegateQueue; | ||
|
||
- (BOOL)listen:(NSString * _Nullable)interface port:(NSUInteger)port error:(NSError * __autoreleasing *)error; | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.