Permalink
Browse files

structure cleanup + addition of ofxLibwebsockets namespace

  • Loading branch information...
robotconscience committed Apr 23, 2012
1 parent 236d9e7 commit 2e1956b49117587e4444944164c61aab2f690bd5
Showing with 1,379 additions and 1,272 deletions.
  1. +70 −38 example - client/LibwebsocketClient.xcodeproj/project.pbxproj
  2. +2 −1 example - client/Project.xcconfig
  3. +6 −8 example - client/src/testApp.cpp
  4. +7 −7 example - client/src/testApp.h
  5. +70 −38 example - server/LibwebsocketServer.xcodeproj/project.pbxproj
  6. +2 −1 example - server/Project.xcconfig
  7. +6 −6 example - server/src/testApp.cpp
  8. +7 −7 example - server/src/testApp.h
  9. +59 −0 libs/ofxLibwebsockets/include/ofxLibwebsockets/Client.h
  10. +53 −0 libs/ofxLibwebsockets/include/ofxLibwebsockets/Connection.h
  11. +38 −0 libs/ofxLibwebsockets/include/ofxLibwebsockets/Events.h
  12. +76 −0 libs/ofxLibwebsockets/include/ofxLibwebsockets/Protocol.h
  13. +68 −0 libs/ofxLibwebsockets/include/ofxLibwebsockets/Reactor.h
  14. +49 −0 libs/ofxLibwebsockets/include/ofxLibwebsockets/Server.h
  15. +195 −0 libs/ofxLibwebsockets/include/ofxLibwebsockets/Util.h
  16. +186 −0 libs/ofxLibwebsockets/src/Client.cpp
  17. +106 −0 libs/ofxLibwebsockets/src/Connection.cpp
  18. +12 −0 libs/ofxLibwebsockets/src/Events.cpp
  19. +106 −0 libs/ofxLibwebsockets/src/Protocol.cpp
  20. +145 −0 libs/ofxLibwebsockets/src/Reactor.cpp
  21. +111 −0 libs/ofxLibwebsockets/src/Server.cpp
  22. +5 −5 src/ofxLibwebsockets.h
  23. +0 −184 src/ofxWebSocketClient.cpp
  24. +0 −57 src/ofxWebSocketClient.h
  25. +0 −106 src/ofxWebSocketConnection.cpp
  26. +0 −43 src/ofxWebSocketConnection.h
  27. +0 −10 src/ofxWebSocketEvents.cpp
  28. +0 −27 src/ofxWebSocketEvents.h
  29. +0 −113 src/ofxWebSocketProtocol.cpp
  30. +0 −65 src/ofxWebSocketProtocol.h
  31. +0 −151 src/ofxWebSocketReactor.cpp
  32. +0 −65 src/ofxWebSocketReactor.h
  33. +0 −108 src/ofxWebSocketServer.cpp
  34. +0 −40 src/ofxWebSocketServer.h
  35. +0 −192 src/ofxWebSocketUtil.h
@@ -8,12 +8,12 @@
/* Begin PBXBuildFile section */
A9587897153E6DFC0015A6B9 /* jsoncpp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A9587896153E6DFC0015A6B9 /* jsoncpp.cpp */; };
- A9C95A3815360A61000BEEF1 /* ofxWebSocketConnection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A9C95A2B15360A61000BEEF1 /* ofxWebSocketConnection.cpp */; };
- A9C95A3915360A61000BEEF1 /* ofxWebSocketEvents.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A9C95A2D15360A61000BEEF1 /* ofxWebSocketEvents.cpp */; };
- A9C95A3A15360A61000BEEF1 /* ofxWebSocketProtocol.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A9C95A2F15360A61000BEEF1 /* ofxWebSocketProtocol.cpp */; };
- A9C95A3B15360A61000BEEF1 /* ofxWebSocketServer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A9C95A3115360A61000BEEF1 /* ofxWebSocketServer.cpp */; };
- A9C95A3F1537191B000BEEF1 /* ofxWebSocketClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A9C95A3E1537191B000BEEF1 /* ofxWebSocketClient.cpp */; };
- A9C95A4215371C36000BEEF1 /* ofxWebSocketReactor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A9C95A4115371C36000BEEF1 /* ofxWebSocketReactor.cpp */; };
+ A98A96F21544D41000D50B3C /* Client.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A98A96EC1544D41000D50B3C /* Client.cpp */; };
+ A98A96F31544D41000D50B3C /* Connection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A98A96ED1544D41000D50B3C /* Connection.cpp */; };
+ A98A96F41544D41000D50B3C /* Events.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A98A96EE1544D41000D50B3C /* Events.cpp */; };
+ A98A96F51544D41000D50B3C /* Protocol.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A98A96EF1544D41000D50B3C /* Protocol.cpp */; };
+ A98A96F61544D41000D50B3C /* Reactor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A98A96F01544D41000D50B3C /* Reactor.cpp */; };
+ A98A96F71544D41000D50B3C /* Server.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A98A96F11544D41000D50B3C /* Server.cpp */; };
BBAB23CB13894F3D00AA2426 /* GLUT.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = BBAB23BE13894E4700AA2426 /* GLUT.framework */; };
E4328149138ABC9F0047C5CB /* openFrameworksDebug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E4328148138ABC890047C5CB /* openFrameworksDebug.a */; };
E45BE97B0E8CC7DD009D7055 /* AGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E45BE9710E8CC7DD009D7055 /* AGL.framework */; };
@@ -68,21 +68,21 @@
A9587896153E6DFC0015A6B9 /* jsoncpp.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = jsoncpp.cpp; sourceTree = "<group>"; };
A9587898153E6E640015A6B9 /* json-forwards.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "json-forwards.h"; sourceTree = "<group>"; };
A9587899153FB2880015A6B9 /* ofxLibwebsockets.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ofxLibwebsockets.h; sourceTree = "<group>"; };
+ A98A96E41544D41000D50B3C /* Client.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Client.h; sourceTree = "<group>"; };
+ A98A96E51544D41000D50B3C /* Connection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Connection.h; sourceTree = "<group>"; };
+ A98A96E61544D41000D50B3C /* Events.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Events.h; sourceTree = "<group>"; };
+ A98A96E71544D41000D50B3C /* Protocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Protocol.h; sourceTree = "<group>"; };
+ A98A96E81544D41000D50B3C /* Reactor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Reactor.h; sourceTree = "<group>"; };
+ A98A96E91544D41000D50B3C /* Server.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Server.h; sourceTree = "<group>"; };
+ A98A96EA1544D41000D50B3C /* Util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Util.h; sourceTree = "<group>"; };
+ A98A96EC1544D41000D50B3C /* Client.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Client.cpp; sourceTree = "<group>"; };
+ A98A96ED1544D41000D50B3C /* Connection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Connection.cpp; sourceTree = "<group>"; };
+ A98A96EE1544D41000D50B3C /* Events.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Events.cpp; sourceTree = "<group>"; };
+ A98A96EF1544D41000D50B3C /* Protocol.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Protocol.cpp; sourceTree = "<group>"; };
+ A98A96F01544D41000D50B3C /* Reactor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Reactor.cpp; sourceTree = "<group>"; };
+ A98A96F11544D41000D50B3C /* Server.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Server.cpp; sourceTree = "<group>"; };
A9C95A2215360A61000BEEF1 /* COPYING */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = COPYING; sourceTree = "<group>"; };
A9C95A2415360A61000BEEF1 /* libwebsockets.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = libwebsockets.h; sourceTree = "<group>"; };
- A9C95A2B15360A61000BEEF1 /* ofxWebSocketConnection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ofxWebSocketConnection.cpp; sourceTree = "<group>"; };
- A9C95A2C15360A61000BEEF1 /* ofxWebSocketConnection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ofxWebSocketConnection.h; sourceTree = "<group>"; };
- A9C95A2D15360A61000BEEF1 /* ofxWebSocketEvents.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ofxWebSocketEvents.cpp; sourceTree = "<group>"; };
- A9C95A2E15360A61000BEEF1 /* ofxWebSocketEvents.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ofxWebSocketEvents.h; sourceTree = "<group>"; };
- A9C95A2F15360A61000BEEF1 /* ofxWebSocketProtocol.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ofxWebSocketProtocol.cpp; sourceTree = "<group>"; };
- A9C95A3015360A61000BEEF1 /* ofxWebSocketProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ofxWebSocketProtocol.h; sourceTree = "<group>"; };
- A9C95A3115360A61000BEEF1 /* ofxWebSocketServer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ofxWebSocketServer.cpp; sourceTree = "<group>"; };
- A9C95A3215360A61000BEEF1 /* ofxWebSocketServer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ofxWebSocketServer.h; sourceTree = "<group>"; };
- A9C95A3C15360ABB000BEEF1 /* ofxWebSocketClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ofxWebSocketClient.h; sourceTree = "<group>"; };
- A9C95A3D153613BC000BEEF1 /* ofxWebSocketUtil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ofxWebSocketUtil.h; sourceTree = "<group>"; };
- A9C95A3E1537191B000BEEF1 /* ofxWebSocketClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ofxWebSocketClient.cpp; sourceTree = "<group>"; };
- A9C95A4015371B4E000BEEF1 /* ofxWebSocketReactor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ofxWebSocketReactor.h; sourceTree = "<group>"; };
- A9C95A4115371C36000BEEF1 /* ofxWebSocketReactor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ofxWebSocketReactor.cpp; sourceTree = "<group>"; };
BBAB23BE13894E4700AA2426 /* GLUT.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GLUT.framework; path = ../../../libs/glut/lib/osx/GLUT.framework; sourceTree = "<group>"; };
E4328143138ABC890047C5CB /* openFrameworksLib.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = openFrameworksLib.xcodeproj; path = ../../../libs/openFrameworksCompiled/project/osx/openFrameworksLib.xcodeproj; sourceTree = SOURCE_ROOT; };
E45BE9710E8CC7DD009D7055 /* AGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AGL.framework; path = /System/Library/Frameworks/AGL.framework; sourceTree = "<absolute>"; };
@@ -149,6 +149,50 @@
path = json;
sourceTree = "<group>";
};
+ A98A96E11544D41000D50B3C /* ofxLibwebsockets */ = {
+ isa = PBXGroup;
+ children = (
+ A98A96E21544D41000D50B3C /* include */,
+ A98A96EB1544D41000D50B3C /* src */,
+ );
+ path = ofxLibwebsockets;
+ sourceTree = "<group>";
+ };
+ A98A96E21544D41000D50B3C /* include */ = {
+ isa = PBXGroup;
+ children = (
+ A98A96E31544D41000D50B3C /* ofxLibwebsockets */,
+ );
+ path = include;
+ sourceTree = "<group>";
+ };
+ A98A96E31544D41000D50B3C /* ofxLibwebsockets */ = {
+ isa = PBXGroup;
+ children = (
+ A98A96E41544D41000D50B3C /* Client.h */,
+ A98A96E51544D41000D50B3C /* Connection.h */,
+ A98A96E61544D41000D50B3C /* Events.h */,
+ A98A96E71544D41000D50B3C /* Protocol.h */,
+ A98A96E81544D41000D50B3C /* Reactor.h */,
+ A98A96E91544D41000D50B3C /* Server.h */,
+ A98A96EA1544D41000D50B3C /* Util.h */,
+ );
+ path = ofxLibwebsockets;
+ sourceTree = "<group>";
+ };
+ A98A96EB1544D41000D50B3C /* src */ = {
+ isa = PBXGroup;
+ children = (
+ A98A96EC1544D41000D50B3C /* Client.cpp */,
+ A98A96ED1544D41000D50B3C /* Connection.cpp */,
+ A98A96EE1544D41000D50B3C /* Events.cpp */,
+ A98A96EF1544D41000D50B3C /* Protocol.cpp */,
+ A98A96F01544D41000D50B3C /* Reactor.cpp */,
+ A98A96F11544D41000D50B3C /* Server.cpp */,
+ );
+ path = src;
+ sourceTree = "<group>";
+ };
A9C959F115360A60000BEEF1 /* ofxLibwebsockets */ = {
isa = PBXGroup;
children = (
@@ -162,6 +206,7 @@
A9C95A2015360A60000BEEF1 /* libs */ = {
isa = PBXGroup;
children = (
+ A98A96E11544D41000D50B3C /* ofxLibwebsockets */,
A9587892153E6DFC0015A6B9 /* jsoncpp */,
A9C95A2115360A60000BEEF1 /* libwebsockets */,
);
@@ -189,19 +234,6 @@
isa = PBXGroup;
children = (
A9587899153FB2880015A6B9 /* ofxLibwebsockets.h */,
- A9C95A3E1537191B000BEEF1 /* ofxWebSocketClient.cpp */,
- A9C95A3C15360ABB000BEEF1 /* ofxWebSocketClient.h */,
- A9C95A2B15360A61000BEEF1 /* ofxWebSocketConnection.cpp */,
- A9C95A2C15360A61000BEEF1 /* ofxWebSocketConnection.h */,
- A9C95A2D15360A61000BEEF1 /* ofxWebSocketEvents.cpp */,
- A9C95A2E15360A61000BEEF1 /* ofxWebSocketEvents.h */,
- A9C95A2F15360A61000BEEF1 /* ofxWebSocketProtocol.cpp */,
- A9C95A3015360A61000BEEF1 /* ofxWebSocketProtocol.h */,
- A9C95A3115360A61000BEEF1 /* ofxWebSocketServer.cpp */,
- A9C95A3215360A61000BEEF1 /* ofxWebSocketServer.h */,
- A9C95A3D153613BC000BEEF1 /* ofxWebSocketUtil.h */,
- A9C95A4115371C36000BEEF1 /* ofxWebSocketReactor.cpp */,
- A9C95A4015371B4E000BEEF1 /* ofxWebSocketReactor.h */,
);
path = src;
sourceTree = "<group>";
@@ -376,13 +408,13 @@
files = (
E4B69E200A3A1BDC003C02F2 /* main.cpp in Sources */,
E4B69E210A3A1BDC003C02F2 /* testApp.cpp in Sources */,
- A9C95A3815360A61000BEEF1 /* ofxWebSocketConnection.cpp in Sources */,
- A9C95A3915360A61000BEEF1 /* ofxWebSocketEvents.cpp in Sources */,
- A9C95A3A15360A61000BEEF1 /* ofxWebSocketProtocol.cpp in Sources */,
- A9C95A3B15360A61000BEEF1 /* ofxWebSocketServer.cpp in Sources */,
- A9C95A3F1537191B000BEEF1 /* ofxWebSocketClient.cpp in Sources */,
- A9C95A4215371C36000BEEF1 /* ofxWebSocketReactor.cpp in Sources */,
A9587897153E6DFC0015A6B9 /* jsoncpp.cpp in Sources */,
+ A98A96F21544D41000D50B3C /* Client.cpp in Sources */,
+ A98A96F31544D41000D50B3C /* Connection.cpp in Sources */,
+ A98A96F41544D41000D50B3C /* Events.cpp in Sources */,
+ A98A96F51544D41000D50B3C /* Protocol.cpp in Sources */,
+ A98A96F61544D41000D50B3C /* Reactor.cpp in Sources */,
+ A98A96F71544D41000D50B3C /* Server.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -9,9 +9,10 @@ LIB_SSL = "$(OF_PATH)/addons/ofxLibwebsockets/libs/openssl/lib/osx/libssl.a"
LIB_CRYPTO = "$(OF_PATH)/addons/ofxLibwebsockets/libs/openssl/lib/osx/libcrypto.a"
SSL_INC = "$(OF_PATH)/addons/ofxLibwebsockets/libs/openssl/"
LWS = "$(OF_PATH)/addons/ofxLibwebsockets/libs/libwebsockets/lib/osx/libwebsockets.a"
+OFX_LWS_INCLUDE = "$(OF_PATH)/addons/ofxLibwebsockets/libs/ofxLibwebsockets/include"
LIBWEBSOCKETS_LIBS = $(LIB_CRYPTO) $(LIB_SSL) $(LWS)
LIBWEBSOCKETS_INCLUDES= $(SSL_INC)
OTHER_LDFLAGS = $(OF_CORE_LIBS) $(LIBWEBSOCKETS_LIBS)
-HEADER_SEARCH_PATHS = $(OF_CORE_HEADERS) $(SSL_INC)
+HEADER_SEARCH_PATHS = $(OF_CORE_HEADERS) $(SSL_INC) $(OFX_LWS_INCLUDE)
@@ -2,8 +2,6 @@
//--------------------------------------------------------------
void testApp::setup(){
- //http://localhost:9091/
-
// connect to websocket.org's echo server on default port
//bool connected = client.connect( "echo.websocket.org", true );
@@ -24,32 +22,32 @@ void testApp::draw(){
}
//--------------------------------------------------------------
-void testApp::onConnect( ofxWebSocketEvent& args ){
+void testApp::onConnect( ofxLibwebsockets::Event& args ){
cout<<"on connected"<<endl;
}
//--------------------------------------------------------------
-void testApp::onOpen( ofxWebSocketEvent& args ){
+void testApp::onOpen( ofxLibwebsockets::Event& args ){
cout<<"on open"<<endl;
}
//--------------------------------------------------------------
-void testApp::onClose( ofxWebSocketEvent& args ){
+void testApp::onClose( ofxLibwebsockets::Event& args ){
cout<<"on close"<<endl;
}
//--------------------------------------------------------------
-void testApp::onIdle( ofxWebSocketEvent& args ){
+void testApp::onIdle( ofxLibwebsockets::Event& args ){
cout<<"on idle"<<endl;
}
//--------------------------------------------------------------
-void testApp::onMessage( ofxWebSocketEvent& args ){
+void testApp::onMessage( ofxLibwebsockets::Event& args ){
cout<<"got message "<<args.message<<endl;
}
//--------------------------------------------------------------
-void testApp::onBroadcast( ofxWebSocketEvent& args ){
+void testApp::onBroadcast( ofxLibwebsockets::Event& args ){
cout<<"got broadcast "<<args.message<<endl;
}
@@ -21,13 +21,13 @@ class testApp : public ofBaseApp{
void dragEvent(ofDragInfo dragInfo);
void gotMessage(ofMessage msg);
- ofxWebSocketClient client;
+ ofxLibwebsockets::Client client;
// websocket methods
- void onConnect( ofxWebSocketEvent& args );
- void onOpen( ofxWebSocketEvent& args );
- void onClose( ofxWebSocketEvent& args );
- void onIdle( ofxWebSocketEvent& args );
- void onMessage( ofxWebSocketEvent& args );
- void onBroadcast( ofxWebSocketEvent& args );
+ void onConnect( ofxLibwebsockets::Event& args );
+ void onOpen( ofxLibwebsockets::Event& args );
+ void onClose( ofxLibwebsockets::Event& args );
+ void onIdle( ofxLibwebsockets::Event& args );
+ void onMessage( ofxLibwebsockets::Event& args );
+ void onBroadcast( ofxLibwebsockets::Event& args );
};
Oops, something went wrong.

0 comments on commit 2e1956b

Please sign in to comment.