Permalink
Browse files

add git ignore

  • Loading branch information...
1 parent 83d4d9a commit 4478a2af6be34c361537b475e0b0ffc006cd74f5 @tonywok tonywok committed Mar 12, 2012
Showing with 113 additions and 0 deletions.
  1. +2 −0 .gitignore
  2. +13 −0 CoccoaSpotbox/ZmqDispatch.h
  3. +13 −0 CoccoaSpotbox/ZmqDispatch.m
  4. +39 −0 ZMQContext.h
  5. +3 −0 ZMQObjC.h
  6. +43 −0 ZMQSocket.h
View
@@ -0,0 +1,2 @@
+app_key.c
+config.h
@@ -0,0 +1,13 @@
+//
+// ZmqDispatch.h
+// CoccoaSpotbox
+//
+// Created by Tony Schneider on 3/8/12.
+// Copyright (c) 2012 Edgecase. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+
+@interface ZmqDispatch : NSObject
+
+@end
@@ -0,0 +1,13 @@
+//
+// ZmqDispatch.m
+// CoccoaSpotbox
+//
+// Created by Tony Schneider on 3/8/12.
+// Copyright (c) 2012 Edgecase. All rights reserved.
+//
+
+#import "ZmqDispatch.h"
+
+@implementation ZmqDispatch
+
+@end
View
@@ -0,0 +1,39 @@
+#import <Foundation/Foundation.h>
+#import "ZMQSocket.h" // ZMQSocketType
+#import <libkern/OSAtomic.h>
+
+/* Special polling timeout values. */
+#define ZMQPollTimeoutNever (-1)
+#define ZMQPollTimeoutNow (0)
+
+@interface ZMQContext : NSObject {
+ void *context;
+ NSMutableArray *sockets;
+ OSSpinLock socketsLock;
+ BOOL terminated;
+}
++ (void)getZMQVersionMajor:(int *)major minor:(int *)minor patch:(int *)patch;
+
+/* Polling */
+// Generic poll interface.
++ (int)pollWithItems:(zmq_pollitem_t *)ioItems count:(int)itemCount
+ timeoutAfterUsec:(long)usec;
+
+// Creates a ZMQContext using |threadCount| threads for I/O.
+- (id)initWithIOThreads:(NSUInteger)threadCount;
+
+- (ZMQSocket *)socketWithType:(ZMQSocketType)type;
+// Sockets associated with this context.
+@property(readonly, retain, NS_NONATOMIC_IPHONEONLY) NSArray *sockets;
+
+// Closes all associated sockets.
+- (void)closeSockets;
+
+// Initiates termination. All associated sockets will be shut down.
+- (void)terminate;
+
+// YES if termination has been initiated.
+// KVOable.
+@property(readonly, getter=isTerminated, NS_NONATOMIC_IPHONEONLY)
+ BOOL terminated;
+@end
View
@@ -0,0 +1,3 @@
+/* Convenience header - imports all ZMQObjc headers. */
+#import "ZMQContext.h"
+#import "ZMQSocket.h"
View
@@ -0,0 +1,43 @@
+#import <Foundation/Foundation.h>
+#import <zmq.h>
+@class ZMQContext;
+
+typedef int ZMQSocketType;
+typedef int ZMQSocketOption;
+typedef int ZMQMessageSendFlags;
+typedef int ZMQMessageReceiveFlags;
+
+@interface ZMQSocket : NSObject {
+ void *socket;
+ ZMQContext *context; // not retained
+ NSString *endpoint;
+ ZMQSocketType type;
+ BOOL closed;
+}
+// Returns @"ZMQ_PUB" for ZMQ_PUB, for example.
++ (NSString *)nameForSocketType:(ZMQSocketType)type;
+
+// Create a socket using -[ZMQContext socketWithType:].
+@property(readonly, assign, NS_NONATOMIC_IPHONEONLY) ZMQContext *context;
+@property(readonly, NS_NONATOMIC_IPHONEONLY) ZMQSocketType type;
+
+- (void)close;
+// KVOable.
+@property(readonly, getter=isClosed, NS_NONATOMIC_IPHONEONLY) BOOL closed;
+@property(readonly, copy, NS_NONATOMIC_IPHONEONLY) NSString *endpoint;
+
+#pragma mark Socket Options
+- (BOOL)setData:(NSData *)data forOption:(ZMQSocketOption)option;
+- (NSData *)dataForOption:(ZMQSocketOption)option;
+
+#pragma mark Endpoint Configuration
+- (BOOL)bindToEndpoint:(NSString *)endpoint;
+- (BOOL)connectToEndpoint:(NSString *)endpoint;
+
+#pragma mark Communication
+- (BOOL)sendData:(NSData *)messageData withFlags:(ZMQMessageSendFlags)flags;
+- (NSData *)receiveDataWithFlags:(ZMQMessageReceiveFlags)flags;
+
+#pragma mark Polling
+- (void)getPollItem:(zmq_pollitem_t *)outItem forEvents:(short)events;
+@end

0 comments on commit 4478a2a

Please sign in to comment.