linuxdcpp-team team mailing list archive
-
linuxdcpp-team team
-
Mailing list archive
-
Message #06913
[Branch ~dcplusplus-team/dcpp-plugin-sdk-c/ExamplePlugin] Rev 17: merge
Merge authors:
poy (poy)
------------------------------------------------------------
revno: 17 [merge]
committer: poy <poy@xxxxxxxxxx>
branch nick: ExamplePlugin
timestamp: Wed 2013-05-22 21:44:45 +0200
message:
merge
added:
packaging/
packaging/packager/
packaging/packager/packager.cpp
modified:
.bzrignore
pluginsdk/PluginDefs.h
projects/make/Makefile
--
lp:~dcplusplus-team/dcpp-plugin-sdk-c/ExamplePlugin
https://code.launchpad.net/~dcplusplus-team/dcpp-plugin-sdk-c/ExamplePlugin
Your team Dcplusplus-team is subscribed to branch lp:~dcplusplus-team/dcpp-plugin-sdk-c/ExamplePlugin.
To unsubscribe from this branch go to https://code.launchpad.net/~dcplusplus-team/dcpp-plugin-sdk-c/ExamplePlugin/+edit-subscription
=== modified file '.bzrignore'
--- .bzrignore 2013-04-28 21:07:59 +0000
+++ .bzrignore 2013-05-22 19:25:44 +0000
@@ -12,6 +12,8 @@
./doc/build.bat
./doc/html
./doc/latex
+./packaging/*
+!./packaging/packager
./projects/make/build*
./projects/vs2010/Debug
./projects/vs2010/ipch
=== added directory 'packaging'
=== added directory 'packaging/packager'
=== added file 'packaging/packager/packager.cpp'
--- packaging/packager/packager.cpp 1970-01-01 00:00:00 +0000
+++ packaging/packager/packager.cpp 2013-05-22 19:25:44 +0000
@@ -0,0 +1,68 @@
+// Generate an info.xml template from the version.h file.
+
+#include <fstream>
+#include <iostream>
+
+#include <pluginsdk/PluginDefs.h>
+#include <src/version.h>
+
+using namespace std;
+
+string escape(string str) {
+ size_t i = 0;
+ while((i = str.find_first_of("<>&", i)) != string::npos) {
+ switch(str[i]) {
+ case '<': str.replace(i, 1, "<"); i += 4; break;
+ case '>': str.replace(i, 1, ">"); i += 4; break;
+ case '&': str.replace(i, 1, "&"); i += 5; break;
+ default: ++i; break;
+ }
+ }
+ return str;
+}
+
+enum { Path = 1, LastCompulsory = Path };
+
+int main(int argc, char* argv[]) {
+ if(argc <= LastCompulsory) {
+ cout << "packager: no path given by the build script" << endl;
+ return 1;
+ }
+
+ ofstream f(argv[Path]);
+ if(!f.is_open()) {
+ cout << "packager: cannot open " << argv[Path] << endl;
+ return 2;
+ }
+
+ f << "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>\n\n"
+ "<!--\n"
+ "This file is an example info.xml to be included in the dcext package. For more\n"
+ "information, read \"Plugin format (dcext).txt\" in the \"doc\" directory.\n\n"
+ "This file has been generated using the information filled in the src/version.h file.\n\n"
+ "Edit the <Plugin> tags to include your plugin files.\n"
+ "If you support Windows, include pe-x64 and pe-x86 platforms.\n"
+ "If you support Linux, include elf-x64 and elf-x86 platforms.\n\n"
+ "The <Files> tag is empty; should you want to distribute additional files, include them\n"
+ "in there within <File> tags (again, more information in the above doc file).\n\n"
+ "When you are done editing this file, rename it to \"info.xml\", move the relevant files\n"
+ "to this directory and zip them; rename that .zip to .dcext and you are done!\n"
+ "-->\n\n"
+ "<dcext>\n"
+ "\t<UUID>" << escape(PLUGIN_GUID).c_str() << "</UUID>\n"
+ "\t<Name>" << escape(PLUGIN_NAME).c_str() << "</Name>\n"
+ "\t<Version>" << PLUGIN_VERSION << "</Version>\n"
+ "\t<ApiVersion>" << DCAPI_CORE_VER << "</ApiVersion>\n"
+ "\t<Author>" << escape(PLUGIN_AUTHOR).c_str() << "</Author>\n"
+ "\t<Description>" << escape(PLUGIN_DESC).c_str() << "</Description>\n"
+ "\t<Website>" << escape(PLUGIN_WEB).c_str() << "</Website>\n"
+ "\t<Plugin Platform=\"elf-x64\">MyPlugin-x64.so</Plugin>\n"
+ "\t<Plugin Platform=\"elf-x86\">MyPlugin-x86.so</Plugin>\n"
+ "\t<Plugin Platform=\"pe-x64\">MyPlugin-x64.dll</Plugin>\n"
+ "\t<Plugin Platform=\"pe-x86\">MyPlugin-x86.dll</Plugin>\n"
+ "\t<Files>\n"
+ "\t</Files>\n"
+ "</dcext>\n";
+
+ return 0;
+}
=== modified file 'pluginsdk/PluginDefs.h'
--- pluginsdk/PluginDefs.h 2013-05-13 17:17:45 +0000
+++ pluginsdk/PluginDefs.h 2013-05-16 18:18:46 +0000
@@ -100,6 +100,8 @@
#define HOOK_NETWORK_HUB_OUT "dcpp.network.onHubDataOut" /* Outgoing protocol message to hub (obj: HubData) */
#define HOOK_NETWORK_CONN_IN "dcpp.network.onClientDataIn" /* Incoming client<->client protocol message (obj: ConnectionData) */
#define HOOK_NETWORK_CONN_OUT "dcpp.network.onClientDataOut" /* Outgoing client<->client protocol message (obj: ConnectionData) */
+#define HOOK_NETWORK_UDP_IN "dcpp.network.onUDPDataIn" /* Incoming UDP data (obj: UDPData) */
+#define HOOK_NETWORK_UDP_OUT "dcpp.network.onUDPDataOut" /* Outgoing UDP data (obj: UDPData) */
#define HOOK_QUEUE_ADDED "dcpp.queue.onAdded" /* (New) item has been added to download queue (obj: QueueData) */
#define HOOK_QUEUE_MOVED "dcpp.queue.onMoved" /* Download queue item has been moved to new location (obj: QueueData) */
@@ -246,6 +248,12 @@
Bool isManaged; /* Always True (Plugins can not lookup, or track the scope of, a specific instance) */
} ConnectionData, *ConnectionDataPtr;
+/* UDP */
+typedef struct tagUDPData {
+ const char* ip; /* The ip address (remote) for this connection */
+ uint16_t port; /* The port for this connection */
+} UDPData, *UDPDataPtr;
+
/* Queue items and files */
typedef struct tagQueueData {
const char* target; /* The *final* location for the file */
=== modified file 'projects/make/Makefile'
--- projects/make/Makefile 2013-05-13 17:40:56 +0000
+++ projects/make/Makefile 2013-05-22 19:44:45 +0000
@@ -26,8 +26,10 @@
COMPILER_SPEC = $(shell $(CC) -dumpmachine)
ifeq ($(findstring mingw, $(COMPILER_SPEC)),)
+ BINEXT =
LIBEXT = .so
else
+ BINEXT = .exe
CPPFLAGS += -D_WIN32_WINNT=0x502 -DWINVER=0x502 -D_WIN32_IE=0x600 \
-DNOMINMAX -DSTRICT -DWIN32_LEAN_AND_MEAN \
-DWIN32 -D_WIN32 -DUNICODE -D_UNICODE
@@ -59,11 +61,20 @@
TARGET := $(OUTPUT_DIR)/$(TARGET)$(LIBEXT)
OBJS := $(addprefix $(OUTPUT_DIR)/, $(OBJS))
-all: $(TARGET)
+PACKAGER = $(OUTPUT_DIR)/packaging/packager$(BINEXT)
+PACK_INFO = ../../packaging/info_generated.xml
+
+all: $(TARGET) $(PACK_INFO)
$(TARGET): $(OBJS)
$(CC) $^ $(LINKFLAGS) $(OUTPUT_OPTION)
+$(PACKAGER): $(OUTPUT_DIR)/packaging/packager/packager.o
+ $(CXX) $^ $(subst -shared,,$(LINKFLAGS) $(LINKXXFLAGS)) $(OUTPUT_OPTION)
+
+$(PACK_INFO): $(PACKAGER)
+ $(PACKAGER) $(PACK_INFO)
+
$(OUTPUT_DIR)/%.o: %.c
$(COMPILE.c) $< $(OUTPUT_OPTION)
@@ -75,7 +86,10 @@
$(OBJS): | $(OUTPUT_DIR)
+$(PACKAGER): | $(OUTPUT_DIR)
+
$(OUTPUT_DIR):
+ $(call MKDIR,$(OUTPUT_DIR)/packaging/packager)
$(call MKDIR,$(OUTPUT_DIR)/pluginsdk)
$(call MKDIR,$(OUTPUT_DIR)/src)