summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authormethodus <methodus@web.de>2012-10-03 22:34:29 +0200
committermethodus <methodus@web.de>2012-10-03 22:34:29 +0200
commit71144aff0555013741b8f1ec320bfd95469179e7 (patch)
tree6e65e109e3bd17e154c9da6567e7c00ba908f2b8 /include
parentd3be5479f0a3eee76ab8b98b1c6488b3cf5e50a5 (diff)
downloadvdr-plugin-upnp-71144aff0555013741b8f1ec320bfd95469179e7.tar.gz
vdr-plugin-upnp-71144aff0555013741b8f1ec320bfd95469179e7.tar.bz2
Splitted tools.h into several tool headers to avoid clashed for example when only requiring string tools but not ixml tools.
Diffstat (limited to 'include')
-rw-r--r--include/tools/error.h67
-rw-r--r--include/tools/ixml.h59
-rw-r--r--include/tools/net.h30
-rw-r--r--include/tools/string.h29
-rw-r--r--include/tools/uuid.h26
5 files changed, 211 insertions, 0 deletions
diff --git a/include/tools/error.h b/include/tools/error.h
new file mode 100644
index 0000000..d8909f9
--- /dev/null
+++ b/include/tools/error.h
@@ -0,0 +1,67 @@
+/*
+ * error.h
+ *
+ * Created on: 03.10.2012
+ * Author: savop
+ */
+
+#ifndef ERROR_H_
+#define ERROR_H_
+
+/****************************************************
+ *
+ * Known Errors
+ *
+ ****************************************************/
+
+/* Errors 401-404, 501 are already defined in
+ * Intel SDK, however 403 MUST NOT USED.
+ */
+
+/****** 600 Common Action Errors ******/
+
+#define UPNP_SOAP_E_ARGUMENT_INVALID 600
+#define UPNP_SOAP_E_ARGUMENT_OUT_OF_RANGE 601
+#define UPNP_SOAP_E_ACTION_NOT_IMPLEMENTED 602
+#define UPNP_SOAP_E_OUT_OF_MEMORY 603
+#define UPNP_SOAP_E_HUMAN_INTERVENTION 604
+#define UPNP_SOAP_E_STRING_TO_LONG 605
+#define UPNP_SOAP_E_NOT_AUTHORIZED 606
+#define UPNP_SOAP_E_SIGNATURE_FAILURE 607
+#define UPNP_SOAP_E_SIGNATURE_MISSING 608
+#define UPNP_SOAP_E_NOT_ENCRYPTED 609
+#define UPNP_SOAP_E_INVALID_SEQUENCE 610
+#define UPNP_SOAP_E_INVALID_CONTROL_URL 611
+#define UPNP_SOAP_E_NO_SUCH_SESSION 612
+
+/****** 700 Action specific Errors ******/
+
+#define UPNP_CDS_E_NO_SUCH_OBJECT 701
+#define UPNP_CDS_E_INVALID_CURRENT_TAG 702
+#define UPNP_CDS_E_INVALID_NEW_TAG 703
+#define UPNP_CDS_E_REQUIRED_TAG 704
+#define UPNP_CDS_E_READ_ONLY_TAG 705
+#define UPNP_CDS_E_PARAMETER_MISMATCH 706
+#define UPNP_CDS_E_INVALID_SEARCH_CRITERIA 708
+#define UPNP_CDS_E_INVALID_SORT_CRITERIA 709
+#define UPNP_CDS_E_NO_SUCH_CONTAINER 710
+#define UPNP_CDS_E_RESTRICTED_OBJECT 711
+#define UPNP_CDS_E_BAD_METADATA 712
+#define UPNP_CDS_E_RESTRICTED_PARENT 713
+#define UPNP_CDS_E_NO_SUCH_SOURCE_RESOURCE 714
+#define UPNP_CDS_E_RESOURCE_ACCESS_DENIED 715
+#define UPNP_CDS_E_TRANSFER_BUSY 716
+#define UPNP_CDS_E_NO_SUCH_FILE_TRANSFER 717
+#define UPNP_CDS_E_NO_SUCH_DESTINATION_RESOURCE 718
+#define UPNP_CDS_E_DEST_RESOURCE_ACCESS_DENIED 719
+#define UPNP_CDS_E_CANT_PROCESS_REQUEST 720
+
+#define UPNP_CMS_E_INCOMPATIBLE_PROTOCOL_INFO 701
+#define UPNP_CMS_E_INCOMPATIBLE_DIRECTIONS 702
+#define UPNP_CMS_E_INSUFFICIENT_RESOURCES 703
+#define UPNP_CMS_E_LOCAL_RESTRICTIONS 704
+#define UPNP_CMS_E_ACCESS_DENIED 705
+#define UPNP_CMS_E_INVALID_CONNECTION_REFERENCE 706
+#define UPNP_CMS_E_NOT_IN_NETWORK 707
+
+#endif /* ERROR_H_ */
diff --git a/include/tools/ixml.h b/include/tools/ixml.h
new file mode 100644
index 0000000..737c753
--- /dev/null
+++ b/include/tools/ixml.h
@@ -0,0 +1,59 @@
+/*
+ * ixml.h
+ *
+ * Created on: 03.10.2012
+ * Author: savop
+ */
+
+#ifndef IXML_H_
+#define IXML_H_
+
+#include <string>
+#include <upnp/upnp.h>
+#include "../tools.h"
+
+using namespace std;
+
+namespace upnp {
+
+namespace ixml {
+
+ void XmlEscapeSpecialChars(string& doc);
+ /**
+ * First occurance of item
+ *
+ * Finds the first occurance of a specified item in a given \bc IXML document and returns its value.
+ * If an error occures, its code is stored in the last parameter \c 'error'.
+ *
+ * @return error the error code in case of an error
+ * @param doc the \c IXML document to be parsed
+ * @param item the item which shall be found
+ * @param the value of the item
+ */
+ int IxmlGetFirstDocumentItem( IN IXML_Document * doc, IN const string item, string& value );
+ /**
+ * Adds a property
+ *
+ * This adds a UPnP property to an \bc IXML document.
+ * The property must have the pattern "namespace:property@attribute".
+ *
+ * @return returns
+ * - \bc NULL, in case of an error
+ * - \bc the newly created property node or the node at which the attribute was
+ * appended to
+ * @param document the \c IXML document to put the parameter in
+ * @param node the specific node where to put the parameter
+ * @param upnpproperty the upnp property
+ * @param value the value of the upnp property
+ */
+ IXML_Element* IxmlAddProperty(IN IXML_Document* document, IN IXML_Element* node, IN const string& upnpproperty, IN const string& value );
+
+ IXML_Element* IxmlAddFilteredProperty(IN const StringList& Filter, IN IXML_Document* document, IN IXML_Element* node, IN const string& upnpproperty, IN const string& value );
+
+ IXML_Element* IxmlReplaceProperty(IN IXML_Document* document, IN IXML_Element* node, IN const string& upnpproperty, IN const string& newValue );
+}
+
+}
+
+
+#endif /* IXML_H_ */
diff --git a/include/tools/net.h b/include/tools/net.h
new file mode 100644
index 0000000..ba7aa41
--- /dev/null
+++ b/include/tools/net.h
@@ -0,0 +1,30 @@
+/*
+ * net.h
+ *
+ * Created on: 03.10.2012
+ * Author: savop
+ */
+
+#ifndef NET_H_
+#define NET_H_
+
+#include <string>
+#include "../tools.h"
+
+using namespace std;
+
+namespace upnp {
+
+namespace tools {
+
+string GetAddressByInterface(string Interface);
+string GetNetworkInterfaceByIndex(int Index, bool skipLoop);
+StringVector GetNetworkInterfaces(bool skipLoop);
+
+} // namespace tools
+
+} // namespace upnp
+
+
+
+#endif /* NET_H_ */
diff --git a/include/tools/string.h b/include/tools/string.h
new file mode 100644
index 0000000..0ff5434
--- /dev/null
+++ b/include/tools/string.h
@@ -0,0 +1,29 @@
+/*
+ * string.h
+ *
+ * Created on: 03.10.2012
+ * Author: savop
+ */
+
+#ifndef STRING_H_
+#define STRING_H_
+
+#include <string>
+#include "../tools.h"
+
+using namespace std;
+
+namespace upnp {
+
+namespace tools {
+
+string ToString(long number);
+string StringListToCSV(StringList list);
+string IdListToCSV(IdList list);
+void StringExplode(string str, string separator, StringVector& results);
+
+}
+
+} // namespace upnp
+
+#endif /* STRING_H_ */
diff --git a/include/tools/uuid.h b/include/tools/uuid.h
new file mode 100644
index 0000000..0f0d9e6
--- /dev/null
+++ b/include/tools/uuid.h
@@ -0,0 +1,26 @@
+/*
+ * uuid.h
+ *
+ * Created on: 03.10.2012
+ * Author: savop
+ */
+
+#ifndef UUID_H_
+#define UUID_H_
+
+#include <string>
+
+using namespace std;
+
+namespace upnp {
+
+namespace tools {
+
+ string GenerateUUIDFromURL(string url);
+ string GenerateUUIDRandomly();
+
+}
+
+}
+
+#endif /* UUID_H_ */