Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
AsyncUdpSocket with namespace
  • Loading branch information
Max Stepanov committed Aug 11, 2012
1 parent 8658430 commit 062c5e4
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 17 deletions.
39 changes: 28 additions & 11 deletions iphone/Classes/AsyncUdpSocket.h
Expand Up @@ -10,11 +10,30 @@

#import <Foundation/Foundation.h>

@class TI_AsyncSendPacket;
@class TI_AsyncReceivePacket;

extern NSString *const TI_AsyncUdpSocketException;
extern NSString *const TI_AsyncUdpSocketErrorDomain;
#ifndef AsyncSendPacket
#define AsyncSendPacket __TI_NS_SYMBOL(AsyncSendPacket)
#endif
#ifndef AsyncReceivePacket
#define AsyncReceivePacket __TI_NS_SYMBOL(AsyncReceivePacket)
#endif
#ifndef AsyncUdpSocketException
#define AsyncUdpSocketException __TI_NS_SYMBOL(AsyncUdpSocketException)
#endif
#ifndef AsyncUdpSocketErrorDomain
#define AsyncUdpSocketErrorDomain __TI_NS_SYMBOL(AsyncUdpSocketErrorDomain)
#endif
#ifndef AsyncUdpSocket
#define AsyncUdpSocket __TI_NS_SYMBOL(AsyncUdpSocket)
#endif
#ifndef AsyncUdpSocketDelegate
#define AsyncUdpSocketDelegate __TI_NS_SYMBOL(AsyncUdpSocketDelegate)
#endif

@class AsyncSendPacket;
@class AsyncReceivePacket;

extern NSString *const AsyncUdpSocketException;
extern NSString *const AsyncUdpSocketErrorDomain;

enum AsyncUdpSocketError
{
Expand All @@ -28,7 +47,7 @@ enum AsyncUdpSocketError
};
typedef enum AsyncUdpSocketError AsyncUdpSocketError;

@interface TI_AsyncUdpSocket : NSObject
@interface AsyncUdpSocket : NSObject
{
CFSocketRef theSocket4; // IPv4 socket
CFSocketRef theSocket6; // IPv6 socket
Expand All @@ -40,11 +59,11 @@ typedef enum AsyncUdpSocketError AsyncUdpSocketError;
NSArray *theRunLoopModes;

NSMutableArray *theSendQueue;
TI_AsyncSendPacket *theCurrentSend;
AsyncSendPacket *theCurrentSend;
NSTimer *theSendTimer;

NSMutableArray *theReceiveQueue;
TI_AsyncReceivePacket *theCurrentReceive;
AsyncReceivePacket *theCurrentReceive;
NSTimer *theReceiveTimer;

id theDelegate;
Expand Down Expand Up @@ -313,13 +332,11 @@ typedef enum AsyncUdpSocketError AsyncUdpSocketError;

@end

@compatibility_alias AsyncUdpSocket TI_AsyncUdpSocket;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#pragma mark -
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

@protocol TI_AsyncUdpSocketDelegate
@protocol AsyncUdpSocketDelegate
@optional

/**
Expand Down
8 changes: 2 additions & 6 deletions iphone/Classes/AsyncUdpSocket.m
Expand Up @@ -119,7 +119,7 @@ - (void)doReceiveTimeout:(NSTimer *)timer;
/**
* The AsyncSendPacket encompasses the instructions for a single send/write.
**/
@interface TI_AsyncSendPacket : NSObject
@interface AsyncSendPacket : NSObject
{
@public
NSData *buffer;
Expand All @@ -130,8 +130,6 @@ @interface TI_AsyncSendPacket : NSObject
- (id)initWithData:(NSData *)d address:(NSData *)a timeout:(NSTimeInterval)t tag:(long)i;
@end

@compatibility_alias AsyncSendPacket TI_AsyncSendPacket;

@implementation AsyncSendPacket

- (id)initWithData:(NSData *)d address:(NSData *)a timeout:(NSTimeInterval)t tag:(long)i
Expand Down Expand Up @@ -162,7 +160,7 @@ - (void)dealloc
/**
* The AsyncReceivePacket encompasses the instructions for a single receive/read.
**/
@interface TI_AsyncReceivePacket : NSObject
@interface AsyncReceivePacket : NSObject
{
@public
NSTimeInterval timeout;
Expand All @@ -174,8 +172,6 @@ @interface TI_AsyncReceivePacket : NSObject
- (id)initWithTimeout:(NSTimeInterval)t tag:(long)i;
@end

@compatibility_alias AsyncReceivePacket TI_AsyncReceivePacket;

@implementation AsyncReceivePacket

- (id)initWithTimeout:(NSTimeInterval)t tag:(long)i
Expand Down

0 comments on commit 062c5e4

Please sign in to comment.