diff options
| author | Saul Wold <sgw@linux.intel.com> | 2017-09-26 08:25:37 -0700 |
|---|---|---|
| committer | Saul Wold <sgw@linux.intel.com> | 2017-09-26 08:25:37 -0700 |
| commit | a98b71ccadc1458bf3a959e328d5ae814eb7e9b3 (patch) | |
| tree | b493f2ce5b78a56a70e76435658e370d44b2eab8 /common/recipes-bsp/amt | |
| download | meta-dpdk-a98b71ccadc1458bf3a959e328d5ae814eb7e9b3.tar.gz | |
Initial commit from meta-intel 2f1bcac3fb3b42602f689fb4a1092aa5f4cf0c8a
Diffstat (limited to 'common/recipes-bsp/amt')
9 files changed, 2970 insertions, 0 deletions
diff --git a/common/recipes-bsp/amt/files/atnetworktool-printf-fix.patch b/common/recipes-bsp/amt/files/atnetworktool-printf-fix.patch new file mode 100644 index 0000000..6bb03e3 --- /dev/null +++ b/common/recipes-bsp/amt/files/atnetworktool-printf-fix.patch | |||
| @@ -0,0 +1,20 @@ | |||
| 1 | Add a missing debug ifdef causing compilation problems. | ||
| 2 | |||
| 3 | Upstream-Status: Submitted | ||
| 4 | |||
| 5 | Signed-off-by: Tom Zanussi <tom.zanussi (a] intel.com> | ||
| 6 | |||
| 7 | Index: lms-7.1.20/src/tools/ATNetworkTool.cpp | ||
| 8 | =================================================================== | ||
| 9 | --- lms-7.1.20.orig/src/tools/ATNetworkTool.cpp 2012-04-30 23:24:56.693879920 -0500 | ||
| 10 | +++ lms-7.1.20/src/tools/ATNetworkTool.cpp 2012-04-30 23:25:32.363473948 -0500 | ||
| 11 | @@ -302,7 +302,9 @@ | ||
| 12 | close(s); | ||
| 13 | return -1; | ||
| 14 | } | ||
| 15 | +#ifdef LMS_NET_DEBUG | ||
| 16 | printf("successfully binded local\n"); | ||
| 17 | +#endif | ||
| 18 | |||
| 19 | } | ||
| 20 | if (bind(s, addr, addrlen) == -1) { | ||
diff --git a/common/recipes-bsp/amt/files/readlink-declaration.patch b/common/recipes-bsp/amt/files/readlink-declaration.patch new file mode 100644 index 0000000..0246d50 --- /dev/null +++ b/common/recipes-bsp/amt/files/readlink-declaration.patch | |||
| @@ -0,0 +1,18 @@ | |||
| 1 | Add a missing include causing compilation (missing declaration) problems. | ||
| 2 | |||
| 3 | Upstream-Status: Submitted | ||
| 4 | |||
| 5 | Signed-off-by: Tom Zanussi <tom.zanussi (a] intel.com> | ||
| 6 | |||
| 7 | Index: lms-7.1.20/src/tools/ATVersion.cpp | ||
| 8 | =================================================================== | ||
| 9 | --- lms-7.1.20.orig/src/tools/ATVersion.cpp 2012-05-29 20:34:34.061997035 -0500 | ||
| 10 | +++ lms-7.1.20/src/tools/ATVersion.cpp 2012-05-29 20:35:22.671412948 -0500 | ||
| 11 | @@ -40,6 +40,7 @@ | ||
| 12 | #include <cerrno> | ||
| 13 | #include <fstream> | ||
| 14 | #include <dirent.h> | ||
| 15 | +#include <unistd.h> | ||
| 16 | |||
| 17 | #define AT_VERSION_ARGUMENT "--version" | ||
| 18 | #define AT_VERSION_MAXSIZE 40 | ||
diff --git a/common/recipes-bsp/amt/lms/0001-Include-sys-select.h-for-fd_set.patch b/common/recipes-bsp/amt/lms/0001-Include-sys-select.h-for-fd_set.patch new file mode 100644 index 0000000..e28d45a --- /dev/null +++ b/common/recipes-bsp/amt/lms/0001-Include-sys-select.h-for-fd_set.patch | |||
| @@ -0,0 +1,28 @@ | |||
| 1 | From 518a3a277c89a3d6b0a9d3ee552cfa33a1dbd5c6 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Jussi Kukkonen <jussi.kukkonen@intel.com> | ||
| 3 | Date: Mon, 23 Jan 2017 20:45:08 +0200 | ||
| 4 | Subject: [PATCH 1/2] Include sys/select.h for fd_set() | ||
| 5 | |||
| 6 | This is needed at least on musl. | ||
| 7 | |||
| 8 | Upstream-Status: Pending | ||
| 9 | Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com> | ||
| 10 | --- | ||
| 11 | src/mei/MEILinux.cpp | 1 + | ||
| 12 | 1 file changed, 1 insertion(+) | ||
| 13 | |||
| 14 | diff --git a/src/mei/MEILinux.cpp b/src/mei/MEILinux.cpp | ||
| 15 | index 1e9d28f..631270e 100755 | ||
| 16 | --- a/src/mei/MEILinux.cpp | ||
| 17 | +++ b/src/mei/MEILinux.cpp | ||
| 18 | @@ -37,6 +37,7 @@ | ||
| 19 | #include <cerrno> | ||
| 20 | #include <fcntl.h> | ||
| 21 | #include <sys/ioctl.h> | ||
| 22 | +#include <sys/select.h> | ||
| 23 | #include <unistd.h> | ||
| 24 | #include <stdint.h> | ||
| 25 | #include <aio.h> | ||
| 26 | -- | ||
| 27 | 2.1.4 | ||
| 28 | |||
diff --git a/common/recipes-bsp/amt/lms/0001-Protocol.cpp-Add-whitespace-for-gcc6-compile-error.patch b/common/recipes-bsp/amt/lms/0001-Protocol.cpp-Add-whitespace-for-gcc6-compile-error.patch new file mode 100644 index 0000000..17b206e --- /dev/null +++ b/common/recipes-bsp/amt/lms/0001-Protocol.cpp-Add-whitespace-for-gcc6-compile-error.patch | |||
| @@ -0,0 +1,31 @@ | |||
| 1 | From 8d737ba9745bef223c3d3b96899f11c26102ea04 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Saul Wold <sgw@linux.intel.com> | ||
| 3 | Date: Mon, 16 May 2016 09:01:05 -0700 | ||
| 4 | Subject: [PATCH] Protocol.cpp: Add whitespace for gcc6 compile error | ||
| 5 | |||
| 6 | When moving from C++-3 -> C++11 additiona white space is required between | ||
| 7 | User-defined literals. | ||
| 8 | |||
| 9 | Upstream-Status: Pending | ||
| 10 | |||
| 11 | Signed-off-by: Saul Wold <sgw@linux.intel.com> | ||
| 12 | --- | ||
| 13 | src/Protocol.cpp | 2 +- | ||
| 14 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
| 15 | |||
| 16 | diff --git a/src/Protocol.cpp b/src/Protocol.cpp | ||
| 17 | index 1c21a0f..3a4a9bb 100755 | ||
| 18 | --- a/src/Protocol.cpp | ||
| 19 | +++ b/src/Protocol.cpp | ||
| 20 | @@ -1428,7 +1428,7 @@ int Protocol::_handleFQDNChange(const char *fqdn) | ||
| 21 | char host[FQDN_MAX_SIZE + 1]; | ||
| 22 | #define LMS_MAX_LINE_LEN 1023 | ||
| 23 | char line[LMS_MAX_LINE_LEN + 1]; | ||
| 24 | -#define LMS_LINE_SIG_FIRST_WORDS(a) "# LMS GENERATED "a" " | ||
| 25 | +#define LMS_LINE_SIG_FIRST_WORDS(a) "# LMS GENERATED " a " " | ||
| 26 | #define LMS_LINE_SIG_LAST_WORD "LINE" | ||
| 27 | #define LMS_LINE_SIG_LAST_WORD_LEN 4 | ||
| 28 | #define LMS_LINE_SIG(a) LMS_LINE_SIG_FIRST_WORDS(a) LMS_LINE_SIG_LAST_WORD | ||
| 29 | -- | ||
| 30 | 2.5.0 | ||
| 31 | |||
diff --git a/common/recipes-bsp/amt/lms/0002-Use-proper-netinet-in.h-API.patch b/common/recipes-bsp/amt/lms/0002-Use-proper-netinet-in.h-API.patch new file mode 100644 index 0000000..fa2e29a --- /dev/null +++ b/common/recipes-bsp/amt/lms/0002-Use-proper-netinet-in.h-API.patch | |||
| @@ -0,0 +1,31 @@ | |||
| 1 | From 0adc925ca9e005f93d77f373ccda2a6c6cc3ff2f Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Jussi Kukkonen <jussi.kukkonen@intel.com> | ||
| 3 | Date: Mon, 23 Jan 2017 20:46:50 +0200 | ||
| 4 | Subject: [PATCH 2/2] Use proper netinet/in.h API | ||
| 5 | |||
| 6 | in6addr is only guaranteed to contain this member: | ||
| 7 | uint8_t s6_addr[16] | ||
| 8 | Use that instead of the glibc implementation detail __in6_u. | ||
| 9 | |||
| 10 | Upstream-Status: Pending | ||
| 11 | Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com> | ||
| 12 | --- | ||
| 13 | src/tools/ATNetworkTool.cpp | 2 +- | ||
| 14 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
| 15 | |||
| 16 | diff --git a/src/tools/ATNetworkTool.cpp b/src/tools/ATNetworkTool.cpp | ||
| 17 | index 66e27df..0789c79 100755 | ||
| 18 | --- a/src/tools/ATNetworkTool.cpp | ||
| 19 | +++ b/src/tools/ATNetworkTool.cpp | ||
| 20 | @@ -207,7 +207,7 @@ int ATNetworkTool::GetSockPeerIP(int sock, ATAddressList & peerAddresses, int &e | ||
| 21 | if(sa->sa_family == AF_INET6 && IN6_IS_ADDR_V4MAPPED(&addr)) //if(IN6_IS_ADDR_V4COMPAT(&addr)) | ||
| 22 | { | ||
| 23 | struct in_addr demapped_addr; | ||
| 24 | - memcpy(&demapped_addr.s_addr, &addr.__in6_u.__u6_addr8[12], 4); | ||
| 25 | + memcpy(&demapped_addr.s_addr, &addr.s6_addr[12], 4); | ||
| 26 | |||
| 27 | struct sockaddr_in sa_in; | ||
| 28 | sa_in.sin_family = AF_INET; | ||
| 29 | -- | ||
| 30 | 2.1.4 | ||
| 31 | |||
diff --git a/common/recipes-bsp/amt/lms/0003-Fix-device-file-referance-to-dev-mei0-remove-select.patch b/common/recipes-bsp/amt/lms/0003-Fix-device-file-referance-to-dev-mei0-remove-select.patch new file mode 100644 index 0000000..433d301 --- /dev/null +++ b/common/recipes-bsp/amt/lms/0003-Fix-device-file-referance-to-dev-mei0-remove-select.patch | |||
| @@ -0,0 +1,91 @@ | |||
| 1 | Fix device file referance to /dev/mei0, remove select post write. | ||
| 2 | |||
| 3 | LMS uses /dev/mei character device which is absent on current kernel versions causing LMS fail to initialize. LMS sends messages to MEI with a post select timeout. Select timeout causes SendMessage to fail causing LMS to not to communicate properly with MEI. | ||
| 4 | |||
| 5 | Adding /dev/mei0 device file reference to check first and then /dev/mei sucessfully initializes LMS. Rely on write return length and remove select with timeout to fix communication with MEI. | ||
| 6 | |||
| 7 | Upstream-Status: Pending | ||
| 8 | |||
| 9 | Signed-off-by: Anand Vastrad <anand.vastrad@intel.com> | ||
| 10 | --- | ||
| 11 | src/mei/MEILinux.cpp | 43 +++++++------------------------------------ | ||
| 12 | 1 file changed, 7 insertions(+), 36 deletions(-) | ||
| 13 | |||
| 14 | diff --git a/src/mei/MEILinux.cpp b/src/mei/MEILinux.cpp | ||
| 15 | index 1e9d28f..6d23f54 100755 | ||
| 16 | --- a/src/mei/MEILinux.cpp | ||
| 17 | +++ b/src/mei/MEILinux.cpp | ||
| 18 | @@ -94,13 +94,17 @@ bool MEILinux::Init(unsigned char reqProtocolVersion) | ||
| 19 | Deinit(); | ||
| 20 | } | ||
| 21 | |||
| 22 | - _fd = open("/dev/mei", O_RDWR); | ||
| 23 | + _fd = open("/dev/mei0", O_RDWR); | ||
| 24 | |||
| 25 | if (_fd == -1 ) { | ||
| 26 | if (_verbose) { | ||
| 27 | - fprintf(stderr, "Error: Cannot establish a handle to the MEI driver\n"); | ||
| 28 | + fprintf(stderr, "Warning: Cannot establish a handle to the MEI driver mei0, retrying with mei \n"); | ||
| 29 | + } | ||
| 30 | + _fd = open("/dev/mei", O_RDWR); | ||
| 31 | + if (_fd == -1 ) { | ||
| 32 | + fprintf(stderr, "Error: Cannot establish a handle to the MEI driver mei\n"); | ||
| 33 | + return false; | ||
| 34 | } | ||
| 35 | - return false; | ||
| 36 | } | ||
| 37 | _initialized = true; | ||
| 38 | |||
| 39 | @@ -181,13 +185,7 @@ int MEILinux::ReceiveMessage(unsigned char *buffer, int len, unsigned long timeo | ||
| 40 | int MEILinux::SendMessage(const unsigned char *buffer, int len, unsigned long timeout) | ||
| 41 | { | ||
| 42 | int rv = 0; | ||
| 43 | - int return_length =0; | ||
| 44 | int error = 0; | ||
| 45 | - fd_set set; | ||
| 46 | - struct timeval tv; | ||
| 47 | - | ||
| 48 | - tv.tv_sec = timeout / 1000; | ||
| 49 | - tv.tv_usec =(timeout % 1000) * 1000000; | ||
| 50 | |||
| 51 | if (_verbose) { | ||
| 52 | fprintf(stdout, "call write length = %d\n", len); | ||
| 53 | @@ -198,35 +196,8 @@ int MEILinux::SendMessage(const unsigned char *buffer, int len, unsigned long ti | ||
| 54 | if (_verbose) { | ||
| 55 | fprintf(stderr,"write failed with status %d %d\n", rv, error); | ||
| 56 | } | ||
| 57 | - goto out; | ||
| 58 | - } | ||
| 59 | - | ||
| 60 | - return_length = rv; | ||
| 61 | - | ||
| 62 | - FD_ZERO(&set); | ||
| 63 | - FD_SET(_fd, &set); | ||
| 64 | - rv = select(_fd+1 ,&set, NULL, NULL, &tv); | ||
| 65 | - if (rv > 0 && FD_ISSET(_fd, &set)) { | ||
| 66 | - if (_verbose) { | ||
| 67 | - fprintf(stderr, "write success\n"); | ||
| 68 | - } | ||
| 69 | } | ||
| 70 | - else if (rv == 0) { | ||
| 71 | - if (_verbose) { | ||
| 72 | - fprintf(stderr, "write failed on timeout with status\n"); | ||
| 73 | - } | ||
| 74 | - goto out; | ||
| 75 | - } | ||
| 76 | - else { //rv<0 | ||
| 77 | - if (_verbose) { | ||
| 78 | - fprintf(stderr, "write failed on select with status %d\n", rv); | ||
| 79 | - } | ||
| 80 | - goto out; | ||
| 81 | - } | ||
| 82 | - | ||
| 83 | - rv = return_length; | ||
| 84 | |||
| 85 | -out: | ||
| 86 | if (rv < 0) { | ||
| 87 | Deinit(); | ||
| 88 | } | ||
| 89 | -- | ||
| 90 | 2.7.4 | ||
| 91 | |||
diff --git a/common/recipes-bsp/amt/lms/0004-Intel-AMT-ME-real-time-notification-infra.patch b/common/recipes-bsp/amt/lms/0004-Intel-AMT-ME-real-time-notification-infra.patch new file mode 100644 index 0000000..04f584a --- /dev/null +++ b/common/recipes-bsp/amt/lms/0004-Intel-AMT-ME-real-time-notification-infra.patch | |||
| @@ -0,0 +1,2647 @@ | |||
| 1 | Added Intel AMT ME real time notification infra to LMS. | ||
| 2 | |||
| 3 | Notification support now actively captures all the INTEL AMT ME events by plugging in to APF infra. | ||
| 4 | These events message are in the WsMan XML format. WsMan XML is parsed to get the AlertID and Message arguments. | ||
| 5 | A map is initialized initially by reading AMTAlerts.xml which provides alertid,messageArguements and verbose description. | ||
| 6 | From AlertID, verbose description is obtained and then using d-bus infra verbose description is notified to the user. | ||
| 7 | |||
| 8 | src/tools/utils.cpp Utils class provides static methods for string manipulation and desktop notification. | ||
| 9 | src/tools/miniXmlParser.cpp MiniXmlParser class provide methods for parsing the xmlBuffer, validation and retreving tag/value. | ||
| 10 | src/tools/httpParser.cpp HttpParser class provides method to parse http response buffer and populate header,body,headerfields properties. | ||
| 11 | src/alertDescription.cpp AlertDescription class parses AMTAlerts.xml like xml to populate map of alertId-Arguments and verbose desctiption. | ||
| 12 | src/alertIndication.cpp AlertIndication class provides binding to some xmlTags. It uses MiniXmlParse to parse xmlBuffer and provides access methods to some of the fields. | ||
| 13 | src/defaultAlerts.cpp provides default AlertID-Description paris. This is used in absence of AMTAlerts.xml. | ||
| 14 | src/notifyDesktop.sh is script which uses d-bus infra to pop up desktop notification. The following script can be modified based on device environment and libraries installed. | ||
| 15 | src/LMEConnection.cpp has modified the buffer 4x times because of the size of AMT ME Xml data. | ||
| 16 | src/Protocol.cpp [ _UNSHandler(char *data, int dataLength) ] has changes to recieve AMT ME event data, gracefully process the data and close the channel. | ||
| 17 | |||
| 18 | src/tools/miniXmlParser.cpp has derived work from http://info.meshcentral.com/downloads/MeshAgentFullSource.rar microstack. Author: Bryan Y Roe <bryan.y.roe@intel.com>/Intel Corporation. | ||
| 19 | |||
| 20 | Upstream-Status: Pending | ||
| 21 | |||
| 22 | Signed-off-by: AnandVastrad <anand.vastrad@intel.com> | ||
| 23 | --- | ||
| 24 | Makefile.in | 2 + | ||
| 25 | src/AMTAlerts.xml | 464 ++++++++++++++++++++++++++++++++++++++++++++ | ||
| 26 | src/LMEConnection.cpp | 2 +- | ||
| 27 | src/Makefile.am | 3 + | ||
| 28 | src/Makefile.in | 172 ++++++++++++++-- | ||
| 29 | src/Makefile.inc | 20 +- | ||
| 30 | src/Protocol.cpp | 191 +++++++++++++++--- | ||
| 31 | src/Protocol.h | 8 +- | ||
| 32 | src/alertDescription.cpp | 144 ++++++++++++++ | ||
| 33 | src/alertDescription.h | 45 +++++ | ||
| 34 | src/alertIndication.cpp | 90 +++++++++ | ||
| 35 | src/alertIndication.h | 54 ++++++ | ||
| 36 | src/defaultAlerts.h | 43 ++++ | ||
| 37 | src/notifyDesktop.sh | 10 + | ||
| 38 | src/tools/httpParser.cpp | 101 ++++++++++ | ||
| 39 | src/tools/httpParser.h | 49 +++++ | ||
| 40 | src/tools/miniXmlParser.cpp | 375 +++++++++++++++++++++++++++++++++++ | ||
| 41 | src/tools/miniXmlParser.h | 51 +++++ | ||
| 42 | src/tools/utils.cpp | 185 ++++++++++++++++++ | ||
| 43 | src/tools/utils.h | 57 ++++++ | ||
| 44 | src/tools/xmlNode.cpp | 45 +++++ | ||
| 45 | src/tools/xmlNode.h | 49 +++++ | ||
| 46 | 22 files changed, 2105 insertions(+), 55 deletions(-) | ||
| 47 | mode change 100755 => 100644 Makefile.in | ||
| 48 | create mode 100755 src/AMTAlerts.xml | ||
| 49 | mode change 100755 => 100644 src/Makefile.in | ||
| 50 | create mode 100644 src/alertDescription.cpp | ||
| 51 | create mode 100644 src/alertDescription.h | ||
| 52 | create mode 100644 src/alertIndication.cpp | ||
| 53 | create mode 100644 src/alertIndication.h | ||
| 54 | create mode 100644 src/defaultAlerts.h | ||
| 55 | create mode 100644 src/notifyDesktop.sh | ||
| 56 | create mode 100644 src/tools/httpParser.cpp | ||
| 57 | create mode 100644 src/tools/httpParser.h | ||
| 58 | create mode 100644 src/tools/miniXmlParser.cpp | ||
| 59 | create mode 100644 src/tools/miniXmlParser.h | ||
| 60 | create mode 100644 src/tools/utils.cpp | ||
| 61 | create mode 100644 src/tools/utils.h | ||
| 62 | create mode 100644 src/tools/xmlNode.cpp | ||
| 63 | create mode 100644 src/tools/xmlNode.h | ||
| 64 | |||
| 65 | diff --git a/Makefile.in b/Makefile.in | ||
| 66 | old mode 100755 | ||
| 67 | new mode 100644 | ||
| 68 | index f90be60..e1a248b | ||
| 69 | --- a/Makefile.in | ||
| 70 | +++ b/Makefile.in | ||
| 71 | @@ -133,6 +133,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ | ||
| 72 | PACKAGE_NAME = @PACKAGE_NAME@ | ||
| 73 | PACKAGE_STRING = @PACKAGE_STRING@ | ||
| 74 | PACKAGE_TARNAME = @PACKAGE_TARNAME@ | ||
| 75 | +PACKAGE_URL = @PACKAGE_URL@ | ||
| 76 | PACKAGE_VERSION = @PACKAGE_VERSION@ | ||
| 77 | PATH_SEPARATOR = @PATH_SEPARATOR@ | ||
| 78 | RANLIB = @RANLIB@ | ||
| 79 | @@ -185,6 +186,7 @@ pdfdir = @pdfdir@ | ||
| 80 | prefix = @prefix@ | ||
| 81 | program_transform_name = @program_transform_name@ | ||
| 82 | psdir = @psdir@ | ||
| 83 | +runstatedir = @runstatedir@ | ||
| 84 | sbindir = @sbindir@ | ||
| 85 | sharedstatedir = @sharedstatedir@ | ||
| 86 | sysconfdir = @sysconfdir@ | ||
| 87 | diff --git a/src/AMTAlerts.xml b/src/AMTAlerts.xml | ||
| 88 | new file mode 100755 | ||
| 89 | index 0000000..ddb3383 | ||
| 90 | --- /dev/null | ||
| 91 | +++ b/src/AMTAlerts.xml | ||
| 92 | @@ -0,0 +1,464 @@ | ||
| 93 | +<?xml version="1.0" encoding="utf-8" standalone="no"?> | ||
| 94 | +<!-- Copyright (c) Intel Corporation, 2010 All Rights Reserved. --> | ||
| 95 | +<Alerts> | ||
| 96 | +<Alert> | ||
| 97 | +<Id>iAMT0001</Id> | ||
| 98 | +<Arg></Arg> | ||
| 99 | +<Message>System Defense Policy triggered.</Message> | ||
| 100 | +</Alert> | ||
| 101 | +<Alert> | ||
| 102 | +<Id>iAMT0002</Id> | ||
| 103 | +<Arg></Arg> | ||
| 104 | +<Message>Agent Presence Agent not started.</Message> | ||
| 105 | +</Alert> | ||
| 106 | +<Alert> | ||
| 107 | +<Id>iAMT0003</Id> | ||
| 108 | +<Arg></Arg> | ||
| 109 | +<Message>Agent Presence Agent stopped.</Message> | ||
| 110 | +</Alert> | ||
| 111 | +<Alert> | ||
| 112 | +<Id>iAMT0004</Id> | ||
| 113 | +<Arg></Arg> | ||
| 114 | +<Message>Agent Presence: running.</Message> | ||
| 115 | +</Alert> | ||
| 116 | +<Alert> | ||
| 117 | +<Id>iAMT0005</Id> | ||
| 118 | +<Arg></Arg> | ||
| 119 | +<Message>Agent Presence: expired.</Message> | ||
| 120 | +</Alert> | ||
| 121 | +<Alert> | ||
| 122 | +<Id>iAMT0006</Id> | ||
| 123 | +<Arg></Arg> | ||
| 124 | +<Message>Agent Presence: suspended.</Message> | ||
| 125 | +</Alert> | ||
| 126 | +<Alert> | ||
| 127 | +<Id>iAMT0007</Id> | ||
| 128 | +<Arg></Arg> | ||
| 129 | +<Message>Host software attempt to disable AMT Network link detected.</Message> | ||
| 130 | +</Alert> | ||
| 131 | +<Alert> | ||
| 132 | +<Id>iAMT0008</Id> | ||
| 133 | +<Arg></Arg> | ||
| 134 | +<Message>Host software attempt to disable AMT Network link detected -- Host Network link blocked.</Message> | ||
| 135 | +</Alert> | ||
| 136 | +<Alert> | ||
| 137 | +<Id>iAMT0009</Id> | ||
| 138 | +<Arg></Arg> | ||
| 139 | +<Message>AMT clock or FLASH wear-out protection disabled.</Message> | ||
| 140 | +</Alert> | ||
| 141 | +<Alert> | ||
| 142 | +<Id>iAMT0010</Id> | ||
| 143 | +<Arg></Arg> | ||
| 144 | +<Message>Intel(R) AMT Network Interface: Heuristics defense slow threshold trespassed.</Message> | ||
| 145 | +</Alert> | ||
| 146 | +<Alert> | ||
| 147 | +<Id>iAMT0011</Id> | ||
| 148 | +<Arg></Arg> | ||
| 149 | +<Message>Intel(R) AMT Network Interface: Heuristics defense fast threshold trespassed.</Message> | ||
| 150 | +</Alert> | ||
| 151 | +<Alert> | ||
| 152 | +<Id>iAMT0012</Id> | ||
| 153 | +<Arg></Arg> | ||
| 154 | +<Message>Intel(R) AMT Network Interface: Heuristics defense factory defined threshold trespassed.</Message> | ||
| 155 | +</Alert> | ||
| 156 | +<Alert> | ||
| 157 | +<Id>iAMT0013</Id> | ||
| 158 | +<Arg></Arg> | ||
| 159 | +<Message>Intel(R) AMT Network Interface: Heuristics defense Encounter timeout expired.</Message> | ||
| 160 | +</Alert> | ||
| 161 | +<Alert> | ||
| 162 | +<Id>iAMT0014</Id> | ||
| 163 | +<Arg></Arg> | ||
| 164 | +<Message>General certificate error.</Message> | ||
| 165 | +</Alert> | ||
| 166 | +<Alert> | ||
| 167 | +<Id>iAMT0015</Id> | ||
| 168 | +<Arg></Arg> | ||
| 169 | +<Message>Certificate expired.</Message> | ||
| 170 | +</Alert> | ||
| 171 | +<Alert> | ||
| 172 | +<Id>iAMT0016</Id> | ||
| 173 | +<Arg></Arg> | ||
| 174 | +<Message>No trusted root certificate.</Message> | ||
| 175 | +</Alert> | ||
| 176 | +<Alert> | ||
| 177 | +<Id>iAMT0017</Id> | ||
| 178 | +<Arg></Arg> | ||
| 179 | +<Message>Not configured to work with server certificate.</Message> | ||
| 180 | +</Alert> | ||
| 181 | +<Alert> | ||
| 182 | +<Id>iAMT0018</Id> | ||
| 183 | +<Arg></Arg> | ||
| 184 | +<Message>Certificate revoked.</Message> | ||
| 185 | +</Alert> | ||
| 186 | +<Alert> | ||
| 187 | +<Id>iAMT0019</Id> | ||
| 188 | +<Arg></Arg> | ||
| 189 | +<Message>RSA exponent too large.</Message> | ||
| 190 | +</Alert> | ||
| 191 | +<Alert> | ||
| 192 | +<Id>iAMT0020</Id> | ||
| 193 | +<Arg></Arg> | ||
| 194 | +<Message>RSA modulus too large.</Message> | ||
| 195 | +</Alert> | ||
| 196 | +<Alert> | ||
| 197 | +<Id>iAMT0021</Id> | ||
| 198 | +<Arg></Arg> | ||
| 199 | +<Message>Unsupported digest.</Message> | ||
| 200 | +</Alert> | ||
| 201 | +<Alert> | ||
| 202 | +<Id>iAMT0022</Id> | ||
| 203 | +<Arg></Arg> | ||
| 204 | +<Message>Distinguished name too long.</Message> | ||
| 205 | +</Alert> | ||
| 206 | +<Alert> | ||
| 207 | +<Id>iAMT0023</Id> | ||
| 208 | +<Arg></Arg> | ||
| 209 | +<Message>Key usage missing.</Message> | ||
| 210 | +</Alert> | ||
| 211 | +<Alert> | ||
| 212 | +<Id>iAMT0024</Id> | ||
| 213 | +<Arg></Arg> | ||
| 214 | +<Message>General SSL handshake error.</Message> | ||
| 215 | +</Alert> | ||
| 216 | +<Alert> | ||
| 217 | +<Id>iAMT0025</Id> | ||
| 218 | +<Arg></Arg> | ||
| 219 | +<Message>General 802.1x error.</Message> | ||
| 220 | +</Alert> | ||
| 221 | +<Alert> | ||
| 222 | +<Id>iAMT0026</Id> | ||
| 223 | +<Arg></Arg> | ||
| 224 | +<Message>AMT Diagnostic AlertEAC error - General NAC error.</Message> | ||
| 225 | +</Alert> | ||
| 226 | +<Alert> | ||
| 227 | +<Id>iAMT0027</Id> | ||
| 228 | +<Arg></Arg> | ||
| 229 | +<Message>AMT Diagnostic AlertEAC error - attempt to get a NAC posture while AMT NAC is disabled.</Message> | ||
| 230 | +</Alert> | ||
| 231 | +<Alert> | ||
| 232 | +<Id>iAMT0028</Id> | ||
| 233 | +<Arg></Arg> | ||
| 234 | +<Message>AMT Diagnostic AlertEAC error - attempt to get a posture of an unsupported type.</Message> | ||
| 235 | +</Alert> | ||
| 236 | +<Alert> | ||
| 237 | +<Id>iAMT0029</Id> | ||
| 238 | +<Arg></Arg> | ||
| 239 | +<Message>Audit log storage is 50% full.</Message> | ||
| 240 | +</Alert> | ||
| 241 | +<Alert> | ||
| 242 | +<Id>iAMT0030</Id> | ||
| 243 | +<Arg></Arg> | ||
| 244 | +<Message>Audit log storage is 75% full.</Message> | ||
| 245 | +</Alert> | ||
| 246 | +<Alert> | ||
| 247 | +<Id>iAMT0031</Id> | ||
| 248 | +<Arg></Arg> | ||
| 249 | +<Message>Audit log storage is 85% full.</Message> | ||
| 250 | +</Alert> | ||
| 251 | +<Alert> | ||
| 252 | +<Id>iAMT0032</Id> | ||
| 253 | +<Arg></Arg> | ||
| 254 | +<Message>Audit log storage is 95% full.</Message> | ||
| 255 | +</Alert> | ||
| 256 | +<Alert> | ||
| 257 | +<Id>iAMT0033</Id> | ||
| 258 | +<Arg></Arg> | ||
| 259 | +<Message>Audit log storage is full.</Message> | ||
| 260 | +</Alert> | ||
| 261 | +<Alert> | ||
| 262 | +<Id>iAMT0034</Id> | ||
| 263 | +<Arg></Arg> | ||
| 264 | +<Message>Firmware Update Event - Partial.</Message> | ||
| 265 | +</Alert> | ||
| 266 | +<Alert> | ||
| 267 | +<Id>iAMT0035</Id> | ||
| 268 | +<Arg></Arg> | ||
| 269 | +<Message>Firmware Update Event - Failure.</Message> | ||
| 270 | +</Alert> | ||
| 271 | +<Alert> | ||
| 272 | +<Id>iAMT0036</Id> | ||
| 273 | +<Arg></Arg> | ||
| 274 | +<Message>Remote connectivity initiated.</Message> | ||
| 275 | +</Alert> | ||
| 276 | +<Alert> | ||
| 277 | +<Id>iAMT0037</Id> | ||
| 278 | +<Arg></Arg> | ||
| 279 | +<Message>ME Presence event.</Message> | ||
| 280 | +</Alert> | ||
| 281 | +<Alert> | ||
| 282 | +<Id>iAMT0038</Id> | ||
| 283 | +<Arg>0</Arg> | ||
| 284 | +<Message>AMT is being unprovisioned using BIOS command.</Message> | ||
| 285 | +</Alert> | ||
| 286 | +<Alert> | ||
| 287 | +<Id>iAMT0038</Id> | ||
| 288 | +<Arg>1</Arg> | ||
| 289 | +<Message>AMT is being unprovisioned using Local MEI command.</Message> | ||
| 290 | +</Alert> | ||
| 291 | +<Alert> | ||
| 292 | +<Id>iAMT0038</Id> | ||
| 293 | +<Arg>2</Arg> | ||
| 294 | +<Message>AMT is being unprovisioned using Local WS-MAN/SOAP command.</Message> | ||
| 295 | +</Alert> | ||
| 296 | +<Alert> | ||
| 297 | +<Id>iAMT0038</Id> | ||
| 298 | +<Arg>3</Arg> | ||
| 299 | +<Message>AMT is being unprovisioned using Remote WS-MAN/SOAP command.</Message> | ||
| 300 | +</Alert> | ||
| 301 | +<Alert> | ||
| 302 | +<Id>iAMT0050</Id> | ||
| 303 | +<Arg></Arg> | ||
| 304 | +<Message>User Notification Alert - General Notification.</Message> | ||
| 305 | +</Alert> | ||
| 306 | +<Alert> | ||
| 307 | +<Id>iAMT0050</Id> | ||
| 308 | +<Arg>16</Arg> | ||
| 309 | +<Message>User Notification Alert - Circuit Breaker notification (CB Drop TX filter hit.).</Message> | ||
| 310 | +</Alert> | ||
| 311 | +<Alert> | ||
| 312 | +<Id>iAMT0050</Id> | ||
| 313 | +<Arg>17</Arg> | ||
| 314 | +<Message>User Notification Alert - Circuit Breaker notification (CB Rate Limit TX filter hit.).</Message> | ||
| 315 | +</Alert> | ||
| 316 | +<Alert> | ||
| 317 | +<Id>iAMT0050</Id> | ||
| 318 | +<Arg>18</Arg> | ||
| 319 | +<Message>User Notification Alert - Circuit Breaker notification (CB Drop RX filter hit.).</Message> | ||
| 320 | +</Alert> | ||
| 321 | +<Alert> | ||
| 322 | +<Id>iAMT0050</Id> | ||
| 323 | +<Arg>19</Arg> | ||
| 324 | +<Message>User Notification Alert - Circuit Breaker notification (CB Rate Limit RX filter hit.).</Message> | ||
| 325 | +</Alert> | ||
| 326 | +<Alert> | ||
| 327 | +<Id>iAMT0050</Id> | ||
| 328 | +<Arg>32</Arg> | ||
| 329 | +<Message>User Notification Alert - EAC notification.</Message> | ||
| 330 | +</Alert> | ||
| 331 | +<Alert> | ||
| 332 | +<Id>iAMT0050</Id> | ||
| 333 | +<Arg>48</Arg> | ||
| 334 | +<Message>User Notification Alert - Remote diagnostics - (Remote Redirection session started - SOL).</Message> | ||
| 335 | +</Alert> | ||
| 336 | +<Alert> | ||
| 337 | +<Id>iAMT0050</Id> | ||
| 338 | +<Arg>49</Arg> | ||
| 339 | +<Message>User Notification Alert - Remote diagnostics - (Remote Redirection session stopped - SOL).</Message> | ||
| 340 | +</Alert> | ||
| 341 | +<Alert> | ||
| 342 | +<Id>iAMT0050</Id> | ||
| 343 | +<Arg>50</Arg> | ||
| 344 | +<Message>User Notification Alert - Remote diagnostics. (Remote Redirection session started - IDE-R).</Message> | ||
| 345 | +</Alert> | ||
| 346 | +<Alert> | ||
| 347 | +<Id>iAMT0050</Id> | ||
| 348 | +<Arg>51</Arg> | ||
| 349 | +<Message>User Notification Alert - Remote diagnostics. (Remote Redirection session stopped - IDE-R).</Message> | ||
| 350 | +</Alert> | ||
| 351 | +<Alert> | ||
| 352 | +<Id>iAMT0050</Id> | ||
| 353 | +<Arg>66</Arg> | ||
| 354 | +<Message>User Notification Alert - WLAN notification (Host profile mismatch - Management Interface ignored).</Message> | ||
| 355 | +</Alert> | ||
| 356 | +<Alert> | ||
| 357 | +<Id>iAMT0050</Id> | ||
| 358 | +<Arg>67</Arg> | ||
| 359 | +<Message>User Notification Alert - WLAN notification (Management device overrides host radio).</Message> | ||
| 360 | +</Alert> | ||
| 361 | +<Alert> | ||
| 362 | +<Id>iAMT0050</Id> | ||
| 363 | +<Arg>68</Arg> | ||
| 364 | +<Message>User Notification Alert - WLAN notification (Host profile security mismatch).</Message> | ||
| 365 | +</Alert> | ||
| 366 | +<Alert> | ||
| 367 | +<Id>iAMT0050</Id> | ||
| 368 | +<Arg>69</Arg> | ||
| 369 | +<Message>User Notification Alert - WLAN notification (Management device relinquishes control over host Radio).</Message> | ||
| 370 | +</Alert> | ||
| 371 | +<Alert> | ||
| 372 | +<Id>iAMT0051</Id> | ||
| 373 | +<Arg></Arg> | ||
| 374 | +<Message>User Notification Alert - SecIo event.</Message> | ||
| 375 | +</Alert> | ||
| 376 | +<Alert> | ||
| 377 | +<Id>iAMT0051</Id> | ||
| 378 | +<Arg>0</Arg> | ||
| 379 | +<Message>User Notification Alert - SecIo event semaphore at host.</Message> | ||
| 380 | +</Alert> | ||
| 381 | +<Alert> | ||
| 382 | +<Id>iAMT0051</Id> | ||
| 383 | +<Arg>1</Arg> | ||
| 384 | +<Message>User Notification Alert - semaphore at ME.</Message> | ||
| 385 | +</Alert> | ||
| 386 | +<Alert> | ||
| 387 | +<Id>iAMT0051</Id> | ||
| 388 | +<Arg>2</Arg> | ||
| 389 | +<Message>User Notification Alert - SecIo event - semaphore timeout.</Message> | ||
| 390 | +</Alert> | ||
| 391 | +<Alert> | ||
| 392 | +<Id>iAMT0052</Id> | ||
| 393 | +<Arg></Arg> | ||
| 394 | +<Message>User Notification Alert - KVM session event.</Message> | ||
| 395 | +</Alert> | ||
| 396 | +<Alert> | ||
| 397 | +<Id>iAMT0052</Id> | ||
| 398 | +<Arg>0</Arg> | ||
| 399 | +<Message>User Notification Alert - KVM session requested.</Message> | ||
| 400 | +</Alert> | ||
| 401 | +<Alert> | ||
| 402 | +<Id>iAMT0052</Id> | ||
| 403 | +<Arg>1</Arg> | ||
| 404 | +<Message>User Notification Alert - KVM session started.</Message> | ||
| 405 | +</Alert> | ||
| 406 | +<Alert> | ||
| 407 | +<Id>iAMT0052</Id> | ||
| 408 | +<Arg>2</Arg> | ||
| 409 | +<Message>User Notification Alert - KVM session stopped.</Message> | ||
| 410 | +</Alert> | ||
| 411 | +<Alert> | ||
| 412 | +<Id>iAMT0053</Id> | ||
| 413 | +<Arg></Arg> | ||
| 414 | +<Message>User Notification Alert - RCS notification.</Message> | ||
| 415 | +</Alert> | ||
| 416 | +<Alert> | ||
| 417 | +<Id>iAMT0053</Id> | ||
| 418 | +<Arg>50</Arg> | ||
| 419 | +<Message>User Notification Alert - RCS notification (HW button pressed. Connection initiated automatically).</Message> | ||
| 420 | +</Alert> | ||
| 421 | +<Alert> | ||
| 422 | +<Id>iAMT0053</Id> | ||
| 423 | +<Arg>52</Arg> | ||
| 424 | +<Message>User Notification Alert - RCS notification (HW button pressed. Connection wasn't initiated automatically).</Message> | ||
| 425 | +</Alert> | ||
| 426 | +<Alert> | ||
| 427 | +<Id>iAMT0053</Id> | ||
| 428 | +<Arg>53</Arg> | ||
| 429 | +<Message>User Notification Alert - RCS notification (Contracts updated).</Message> | ||
| 430 | +</Alert> | ||
| 431 | +<Alert> | ||
| 432 | +<Id>iAMT0054</Id> | ||
| 433 | +<Arg></Arg> | ||
| 434 | +<Message>User Notification Alert - WLAN notification. Wireless Profile sync enablement state changed.</Message> | ||
| 435 | +</Alert> | ||
| 436 | +<Alert> | ||
| 437 | +<Id>iAMT0055</Id> | ||
| 438 | +<Arg></Arg> | ||
| 439 | +<Message>User Notification Alert - Provisioning state change notification.</Message> | ||
| 440 | +</Alert> | ||
| 441 | +<Alert> | ||
| 442 | +<Id>iAMT0055</Id> | ||
| 443 | +<Arg>0</Arg> | ||
| 444 | +<Message>User Notification Alert - Provisioning state change notification - Pre-configuration.</Message> | ||
| 445 | +</Alert> | ||
| 446 | +<Alert> | ||
| 447 | +<Id>iAMT0055</Id> | ||
| 448 | +<Arg>1</Arg> | ||
| 449 | +<Message>User Notification Alert - Provisioning state change notification - In configuration.</Message> | ||
| 450 | +</Alert> | ||
| 451 | +<Alert> | ||
| 452 | +<Id>iAMT0055</Id> | ||
| 453 | +<Arg>2</Arg> | ||
| 454 | +<Message>User Notification Alert - Provisioning state change notification - Post-configuration.</Message> | ||
| 455 | +</Alert> | ||
| 456 | +<Alert> | ||
| 457 | +<Id>iAMT0055</Id> | ||
| 458 | +<Arg>3</Arg> | ||
| 459 | +<Message>User Notification Alert - Provisioning state change notification - unprovision process has started.</Message> | ||
| 460 | +</Alert> | ||
| 461 | +<Alert> | ||
| 462 | +<Id>iAMT0056</Id> | ||
| 463 | +<Arg></Arg> | ||
| 464 | +<Message>User Notification Alert - System Defense change notification.</Message> | ||
| 465 | +</Alert> | ||
| 466 | +<Alert> | ||
| 467 | +<Id>iAMT0057</Id> | ||
| 468 | +<Arg></Arg> | ||
| 469 | +<Message>User Notification Alert - Network State change notification.</Message> | ||
| 470 | +</Alert> | ||
| 471 | +<Alert> | ||
| 472 | +<Id>iAMT0058</Id> | ||
| 473 | +<Arg></Arg> | ||
| 474 | +<Message>User Notification Alert - Remote Access change notification.</Message> | ||
| 475 | +</Alert> | ||
| 476 | +<Alert> | ||
| 477 | +<Id>iAMT0058</Id> | ||
| 478 | +<Arg>1</Arg> | ||
| 479 | +<Message>User Notification Alert - Remote Access change notification - tunnel is closed.</Message> | ||
| 480 | +</Alert> | ||
| 481 | +<Alert> | ||
| 482 | +<Id>iAMT0058</Id> | ||
| 483 | +<Arg>1</Arg> | ||
| 484 | +<Message>User Notification Alert - Remote Access change notification - tunnel is open.</Message> | ||
| 485 | +</Alert> | ||
| 486 | +<Alert> | ||
| 487 | +<Id>iAMT0059</Id> | ||
| 488 | +<Arg></Arg> | ||
| 489 | +<Message>User Notification Alert - KVM enabled event.</Message> | ||
| 490 | +</Alert> | ||
| 491 | +<Alert> | ||
| 492 | +<Id>iAMT0059</Id> | ||
| 493 | +<Arg>0</Arg> | ||
| 494 | +<Message>User Notification Alert - KVM enabled event - KVM disabled.</Message> | ||
| 495 | +</Alert> | ||
| 496 | +<Alert> | ||
| 497 | +<Id>iAMT0059</Id> | ||
| 498 | +<Arg>1</Arg> | ||
| 499 | +<Message>User Notification Alert - KVM enabled event - KVM enabled (both from MEBx and PTNI).</Message> | ||
| 500 | +</Alert> | ||
| 501 | +<Alert> | ||
| 502 | +<Id>iAMT0060</Id> | ||
| 503 | +<Arg></Arg> | ||
| 504 | +<Message>User Notification Alert - SecIO configuration event.</Message> | ||
| 505 | +</Alert> | ||
| 506 | +<Alert> | ||
| 507 | +<Id>iAMT0061</Id> | ||
| 508 | +<Arg></Arg> | ||
| 509 | +<Message>ME FW reset occurred.</Message> | ||
| 510 | +</Alert> | ||
| 511 | +<Alert> | ||
| 512 | +<Id>iAMT0062</Id> | ||
| 513 | +<Arg></Arg> | ||
| 514 | +<Message>User Notification Alert - IpSyncEnabled event.</Message> | ||
| 515 | +</Alert> | ||
| 516 | +<Alert> | ||
| 517 | +<Id>iAMT0062</Id> | ||
| 518 | +<Arg>0</Arg> | ||
| 519 | +<Message>User Notification Alert - IpSyncEnabled event - IpSync disabled.</Message> | ||
| 520 | +</Alert> | ||
| 521 | +<Alert> | ||
| 522 | +<Id>iAMT0062</Id> | ||
| 523 | +<Arg>1</Arg> | ||
| 524 | +<Message>User Notification Alert - IpSyncEnabled event - IpSync enabled.</Message> | ||
| 525 | +</Alert> | ||
| 526 | +<Alert> | ||
| 527 | +<Id>iAMT0063</Id> | ||
| 528 | +<Arg></Arg> | ||
| 529 | +<Message>User Notification Alert - HTTP Proxy sync enabled event.</Message> | ||
| 530 | +</Alert> | ||
| 531 | +<Alert> | ||
| 532 | +<Id>iAMT0063</Id> | ||
| 533 | +<Arg>0</Arg> | ||
| 534 | +<Message>User Notification Alert - HTTP Proxy sync enabled event - HTTP Proxy Sync disabled.</Message> | ||
| 535 | +</Alert> | ||
| 536 | +<Alert> | ||
| 537 | +<Id>iAMT0063</Id> | ||
| 538 | +<Arg>1</Arg> | ||
| 539 | +<Message>User Notification Alert - HTTP Proxy sync enabled event - HTTP Proxy Sync enabled.</Message> | ||
| 540 | +</Alert> | ||
| 541 | +<Alert> | ||
| 542 | +<Id>iAMT0064</Id> | ||
| 543 | +<Arg></Arg> | ||
| 544 | +<Message>User Notification Alert - User Consent event.</Message> | ||
| 545 | +</Alert> | ||
| 546 | +<Alert> | ||
| 547 | +<Id>iAMT0064</Id> | ||
| 548 | +<Arg>1</Arg> | ||
| 549 | +<Message>User Notification Alert - User Consent event - User Consent granted.</Message> | ||
| 550 | +</Alert> | ||
| 551 | +<Alert> | ||
| 552 | +<Id>iAMT0064</Id> | ||
| 553 | +<Arg>2</Arg> | ||
| 554 | +<Message>User Notification Alert - User Consent event - User Consent ended.</Message> | ||
| 555 | +</Alert> | ||
| 556 | +</Alerts> | ||
| 557 | diff --git a/src/LMEConnection.cpp b/src/LMEConnection.cpp | ||
| 558 | index f3e7a2b..d192626 100755 | ||
| 559 | --- a/src/LMEConnection.cpp | ||
| 560 | +++ b/src/LMEConnection.cpp | ||
| 561 | @@ -48,7 +48,7 @@ extern glue plugin; | ||
| 562 | |||
| 563 | const GUID LMEConnection::_guid = {0x6733a4db, 0x0476, 0x4e7b, {0xb3, 0xaf, 0xbc, 0xfc, 0x29, 0xbe, 0xe7, 0xa7}}; | ||
| 564 | |||
| 565 | -const UINT32 LMEConnection::RX_WINDOW_SIZE = 1024; | ||
| 566 | +const UINT32 LMEConnection::RX_WINDOW_SIZE = 4096; | ||
| 567 | |||
| 568 | LMEConnection::LMEConnection(bool verbose) : | ||
| 569 | _reqID(0), | ||
| 570 | diff --git a/src/Makefile.am b/src/Makefile.am | ||
| 571 | index 42d9f47..364427b 100755 | ||
| 572 | --- a/src/Makefile.am | ||
| 573 | +++ b/src/Makefile.am | ||
| 574 | @@ -1,4 +1,7 @@ | ||
| 575 | sbin_PROGRAMS=lms | ||
| 576 | +dist_bin_SCRIPTS=notifyDesktop.sh | ||
| 577 | +xml_dir=$(datadir)/xml | ||
| 578 | +xml__DATA=AMTAlerts.xml | ||
| 579 | |||
| 580 | SYNCLIB_SRCDIR=SyncLib/src | ||
| 581 | SYNCLIB_HDRDIR=SyncLib/Include | ||
| 582 | diff --git a/src/Makefile.in b/src/Makefile.in | ||
| 583 | old mode 100755 | ||
| 584 | new mode 100644 | ||
| 585 | index c6fe1ba..7b6cafd | ||
| 586 | --- a/src/Makefile.in | ||
| 587 | +++ b/src/Makefile.in | ||
| 588 | @@ -14,6 +14,8 @@ | ||
| 589 | |||
| 590 | @SET_MAKE@ | ||
| 591 | |||
| 592 | + | ||
| 593 | + | ||
| 594 | srcdir = @srcdir@ | ||
| 595 | top_srcdir = @top_srcdir@ | ||
| 596 | VPATH = @srcdir@ | ||
| 597 | @@ -37,9 +39,9 @@ POST_UNINSTALL = : | ||
| 598 | build_triplet = @build@ | ||
| 599 | host_triplet = @host@ | ||
| 600 | sbin_PROGRAMS = lms$(EXEEXT) | ||
| 601 | -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ | ||
| 602 | - $(srcdir)/Makefile.inc $(srcdir)/iatshareddata.h.in \ | ||
| 603 | - $(srcdir)/plugin.h.in | ||
| 604 | +DIST_COMMON = $(dist_bin_SCRIPTS) $(srcdir)/Makefile.am \ | ||
| 605 | + $(srcdir)/Makefile.in $(srcdir)/Makefile.inc \ | ||
| 606 | + $(srcdir)/iatshareddata.h.in $(srcdir)/plugin.h.in | ||
| 607 | subdir = src | ||
| 608 | ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 | ||
| 609 | am__aclocal_m4_deps = $(top_srcdir)/configure.ac | ||
| 610 | @@ -48,14 +50,17 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ | ||
| 611 | mkinstalldirs = $(install_sh) -d | ||
| 612 | CONFIG_HEADER = $(top_builddir)/config.h | ||
| 613 | CONFIG_CLEAN_FILES = plugin.h iatshareddata.h | ||
| 614 | -am__installdirs = "$(DESTDIR)$(sbindir)" | ||
| 615 | +am__installdirs = "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(bindir)" \ | ||
| 616 | + "$(DESTDIR)$(xml_dir)" | ||
| 617 | sbinPROGRAMS_INSTALL = $(INSTALL_PROGRAM) | ||
| 618 | PROGRAMS = $(sbin_PROGRAMS) | ||
| 619 | am__objects_1 = main.$(OBJEXT) LMEConnection.$(OBJEXT) \ | ||
| 620 | ConfigConnection.$(OBJEXT) Protocol.$(OBJEXT) glue.$(OBJEXT) \ | ||
| 621 | - ChannelGenerator.$(OBJEXT) | ||
| 622 | + ChannelGenerator.$(OBJEXT) alertIndication.$(OBJEXT) \ | ||
| 623 | + alertDescription.$(OBJEXT) | ||
| 624 | am__objects_2 = ATVersion.$(OBJEXT) ATNetworkTool.$(OBJEXT) \ | ||
| 625 | - daemonize.$(OBJEXT) | ||
| 626 | + daemonize.$(OBJEXT) utils.$(OBJEXT) miniXmlParser.$(OBJEXT) \ | ||
| 627 | + xmlNode.$(OBJEXT) httpParser.$(OBJEXT) | ||
| 628 | am__objects_3 = MEILinux.$(OBJEXT) MNGCommand.$(OBJEXT) \ | ||
| 629 | FWULCommand.$(OBJEXT) PTHICommand.$(OBJEXT) | ||
| 630 | am__objects_4 = EventLinux.$(OBJEXT) SemaphoreLinux.$(OBJEXT) \ | ||
| 631 | @@ -68,6 +73,8 @@ am__objects_7 = $(am__objects_6) $(am__objects_6) $(am__objects_6) \ | ||
| 632 | am_lms_OBJECTS = $(am__objects_5) $(am__objects_7) | ||
| 633 | lms_OBJECTS = $(am_lms_OBJECTS) | ||
| 634 | lms_LDADD = $(LDADD) | ||
| 635 | +dist_binSCRIPT_INSTALL = $(INSTALL_SCRIPT) | ||
| 636 | +SCRIPTS = $(dist_bin_SCRIPTS) | ||
| 637 | DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) | ||
| 638 | depcomp = $(SHELL) $(top_srcdir)/depcomp | ||
| 639 | am__depfiles_maybe = depfiles | ||
| 640 | @@ -89,6 +96,14 @@ LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ | ||
| 641 | $(AM_LDFLAGS) $(LDFLAGS) -o $@ | ||
| 642 | SOURCES = $(lms_SOURCES) | ||
| 643 | DIST_SOURCES = $(lms_SOURCES) | ||
| 644 | +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; | ||
| 645 | +am__vpath_adj = case $$p in \ | ||
| 646 | + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ | ||
| 647 | + *) f=$$p;; \ | ||
| 648 | + esac; | ||
| 649 | +am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; | ||
| 650 | +xml_DATA_INSTALL = $(INSTALL_DATA) | ||
| 651 | +DATA = $(xml__DATA) | ||
| 652 | ETAGS = etags | ||
| 653 | CTAGS = ctags | ||
| 654 | DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) | ||
| 655 | @@ -150,6 +165,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ | ||
| 656 | PACKAGE_NAME = @PACKAGE_NAME@ | ||
| 657 | PACKAGE_STRING = @PACKAGE_STRING@ | ||
| 658 | PACKAGE_TARNAME = @PACKAGE_TARNAME@ | ||
| 659 | +PACKAGE_URL = @PACKAGE_URL@ | ||
| 660 | PACKAGE_VERSION = @PACKAGE_VERSION@ | ||
| 661 | PATH_SEPARATOR = @PATH_SEPARATOR@ | ||
| 662 | RANLIB = @RANLIB@ | ||
| 663 | @@ -202,10 +218,14 @@ pdfdir = @pdfdir@ | ||
| 664 | prefix = @prefix@ | ||
| 665 | program_transform_name = @program_transform_name@ | ||
| 666 | psdir = @psdir@ | ||
| 667 | +runstatedir = @runstatedir@ | ||
| 668 | sbindir = @sbindir@ | ||
| 669 | sharedstatedir = @sharedstatedir@ | ||
| 670 | sysconfdir = @sysconfdir@ | ||
| 671 | target_alias = @target_alias@ | ||
| 672 | +dist_bin_SCRIPTS = notifyDesktop.sh | ||
| 673 | +xml_dir = $(datadir)/xml | ||
| 674 | +xml__DATA = AMTAlerts.xml | ||
| 675 | SYNCLIB_SRCDIR = SyncLib/src | ||
| 676 | SYNCLIB_HDRDIR = SyncLib/Include | ||
| 677 | MEI_DIR = mei | ||
| 678 | @@ -238,11 +258,19 @@ $(MEI_DIR)/PTHICommand.cpp | ||
| 679 | |||
| 680 | TOOLS_HDRS = $(TOOLS_DIR)/ATVersion.h \ | ||
| 681 | $(TOOLS_DIR)/ATNetworkTool.h \ | ||
| 682 | -$(TOOLS_DIR)/daemonize.h | ||
| 683 | +$(TOOLS_DIR)/daemonize.h \ | ||
| 684 | +$(TOOLS_DIR)/utils.h \ | ||
| 685 | +$(TOOLS_DIR)/miniXmlParser.h \ | ||
| 686 | +$(TOOLS_DIR)/xmlNode.h \ | ||
| 687 | +$(TOOLS_DIR)/httpParser.h | ||
| 688 | |||
| 689 | TOOLS_SRCS = $(TOOLS_DIR)/ATVersion.cpp \ | ||
| 690 | $(TOOLS_DIR)/ATNetworkTool.cpp \ | ||
| 691 | -$(TOOLS_DIR)/daemonize.cpp | ||
| 692 | +$(TOOLS_DIR)/daemonize.cpp \ | ||
| 693 | +$(TOOLS_DIR)/utils.cpp \ | ||
| 694 | +$(TOOLS_DIR)/miniXmlParser.cpp \ | ||
| 695 | +$(TOOLS_DIR)/xmlNode.cpp \ | ||
| 696 | +$(TOOLS_DIR)/httpParser.cpp | ||
| 697 | |||
| 698 | MAIN_HDRS = types.h \ | ||
| 699 | Channel.h \ | ||
| 700 | @@ -254,14 +282,18 @@ ConfigConnection.h \ | ||
| 701 | Protocol.h \ | ||
| 702 | glue.h \ | ||
| 703 | version.h \ | ||
| 704 | -ChannelGenerator.h | ||
| 705 | +ChannelGenerator.h \ | ||
| 706 | +alertIndication.h \ | ||
| 707 | +alertDescription.h | ||
| 708 | |||
| 709 | MAIN_SRCS = main.cpp \ | ||
| 710 | LMEConnection.cpp \ | ||
| 711 | ConfigConnection.cpp \ | ||
| 712 | Protocol.cpp \ | ||
| 713 | glue.cpp \ | ||
| 714 | -ChannelGenerator.cpp | ||
| 715 | +ChannelGenerator.cpp \ | ||
| 716 | +alertIndication.cpp \ | ||
| 717 | +alertDescription.cpp | ||
| 718 | |||
| 719 | SRCS = $(MAIN_SRCS) \ | ||
| 720 | $(TOOLS_SRCS) \ | ||
| 721 | @@ -342,6 +374,25 @@ clean-sbinPROGRAMS: | ||
| 722 | lms$(EXEEXT): $(lms_OBJECTS) $(lms_DEPENDENCIES) | ||
| 723 | @rm -f lms$(EXEEXT) | ||
| 724 | $(CXXLINK) $(lms_LDFLAGS) $(lms_OBJECTS) $(lms_LDADD) $(LIBS) | ||
| 725 | +install-dist_binSCRIPTS: $(dist_bin_SCRIPTS) | ||
| 726 | + @$(NORMAL_INSTALL) | ||
| 727 | + test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)" | ||
| 728 | + @list='$(dist_bin_SCRIPTS)'; for p in $$list; do \ | ||
| 729 | + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ | ||
| 730 | + if test -f $$d$$p; then \ | ||
| 731 | + f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \ | ||
| 732 | + echo " $(dist_binSCRIPT_INSTALL) '$$d$$p' '$(DESTDIR)$(bindir)/$$f'"; \ | ||
| 733 | + $(dist_binSCRIPT_INSTALL) "$$d$$p" "$(DESTDIR)$(bindir)/$$f"; \ | ||
| 734 | + else :; fi; \ | ||
| 735 | + done | ||
| 736 | + | ||
| 737 | +uninstall-dist_binSCRIPTS: | ||
| 738 | + @$(NORMAL_UNINSTALL) | ||
| 739 | + @list='$(dist_bin_SCRIPTS)'; for p in $$list; do \ | ||
| 740 | + f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \ | ||
| 741 | + echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ | ||
| 742 | + rm -f "$(DESTDIR)$(bindir)/$$f"; \ | ||
| 743 | + done | ||
| 744 | |||
| 745 | mostlyclean-compile: | ||
| 746 | -rm -f *.$(OBJEXT) | ||
| 747 | @@ -355,17 +406,23 @@ distclean-compile: | ||
| 748 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ConfigConnection.Po@am__quote@ | ||
| 749 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/EventLinux.Po@am__quote@ | ||
| 750 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FWULCommand.Po@am__quote@ | ||
| 751 | -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MEILinux.Po@am__quote@ | ||
| 752 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/LMEConnection.Po@am__quote@ | ||
| 753 | +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MEILinux.Po@am__quote@ | ||
| 754 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MNGCommand.Po@am__quote@ | ||
| 755 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PTHICommand.Po@am__quote@ | ||
| 756 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Protocol.Po@am__quote@ | ||
| 757 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/RWLock.Po@am__quote@ | ||
| 758 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SemaphoreLinux.Po@am__quote@ | ||
| 759 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ThreadLinux.Po@am__quote@ | ||
| 760 | +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alertDescription.Po@am__quote@ | ||
| 761 | +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alertIndication.Po@am__quote@ | ||
| 762 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/daemonize.Po@am__quote@ | ||
| 763 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glue.Po@am__quote@ | ||
| 764 | +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/httpParser.Po@am__quote@ | ||
| 765 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@ | ||
| 766 | +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/miniXmlParser.Po@am__quote@ | ||
| 767 | +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utils.Po@am__quote@ | ||
| 768 | +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmlNode.Po@am__quote@ | ||
| 769 | |||
| 770 | .cpp.o: | ||
| 771 | @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ | ||
| 772 | @@ -430,6 +487,62 @@ daemonize.obj: $(TOOLS_DIR)/daemonize.cpp | ||
| 773 | @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ | ||
| 774 | @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o daemonize.obj `if test -f '$(TOOLS_DIR)/daemonize.cpp'; then $(CYGPATH_W) '$(TOOLS_DIR)/daemonize.cpp'; else $(CYGPATH_W) '$(srcdir)/$(TOOLS_DIR)/daemonize.cpp'; fi` | ||
| 775 | |||
| 776 | +utils.o: $(TOOLS_DIR)/utils.cpp | ||
| 777 | +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT utils.o -MD -MP -MF "$(DEPDIR)/utils.Tpo" -c -o utils.o `test -f '$(TOOLS_DIR)/utils.cpp' || echo '$(srcdir)/'`$(TOOLS_DIR)/utils.cpp; \ | ||
| 778 | +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/utils.Tpo" "$(DEPDIR)/utils.Po"; else rm -f "$(DEPDIR)/utils.Tpo"; exit 1; fi | ||
| 779 | +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(TOOLS_DIR)/utils.cpp' object='utils.o' libtool=no @AMDEPBACKSLASH@ | ||
| 780 | +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ | ||
| 781 | +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o utils.o `test -f '$(TOOLS_DIR)/utils.cpp' || echo '$(srcdir)/'`$(TOOLS_DIR)/utils.cpp | ||
| 782 | + | ||
| 783 | +utils.obj: $(TOOLS_DIR)/utils.cpp | ||
| 784 | +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT utils.obj -MD -MP -MF "$(DEPDIR)/utils.Tpo" -c -o utils.obj `if test -f '$(TOOLS_DIR)/utils.cpp'; then $(CYGPATH_W) '$(TOOLS_DIR)/utils.cpp'; else $(CYGPATH_W) '$(srcdir)/$(TOOLS_DIR)/utils.cpp'; fi`; \ | ||
| 785 | +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/utils.Tpo" "$(DEPDIR)/utils.Po"; else rm -f "$(DEPDIR)/utils.Tpo"; exit 1; fi | ||
| 786 | +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(TOOLS_DIR)/utils.cpp' object='utils.obj' libtool=no @AMDEPBACKSLASH@ | ||
| 787 | +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ | ||
| 788 | +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o utils.obj `if test -f '$(TOOLS_DIR)/utils.cpp'; then $(CYGPATH_W) '$(TOOLS_DIR)/utils.cpp'; else $(CYGPATH_W) '$(srcdir)/$(TOOLS_DIR)/utils.cpp'; fi` | ||
| 789 | + | ||
| 790 | +miniXmlParser.o: $(TOOLS_DIR)/miniXmlParser.cpp | ||
| 791 | +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT miniXmlParser.o -MD -MP -MF "$(DEPDIR)/miniXmlParser.Tpo" -c -o miniXmlParser.o `test -f '$(TOOLS_DIR)/miniXmlParser.cpp' || echo '$(srcdir)/'`$(TOOLS_DIR)/miniXmlParser.cpp; \ | ||
| 792 | +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/miniXmlParser.Tpo" "$(DEPDIR)/miniXmlParser.Po"; else rm -f "$(DEPDIR)/miniXmlParser.Tpo"; exit 1; fi | ||
| 793 | +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(TOOLS_DIR)/miniXmlParser.cpp' object='miniXmlParser.o' libtool=no @AMDEPBACKSLASH@ | ||
| 794 | +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ | ||
| 795 | +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o miniXmlParser.o `test -f '$(TOOLS_DIR)/miniXmlParser.cpp' || echo '$(srcdir)/'`$(TOOLS_DIR)/miniXmlParser.cpp | ||
| 796 | + | ||
| 797 | +miniXmlParser.obj: $(TOOLS_DIR)/miniXmlParser.cpp | ||
| 798 | +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT miniXmlParser.obj -MD -MP -MF "$(DEPDIR)/miniXmlParser.Tpo" -c -o miniXmlParser.obj `if test -f '$(TOOLS_DIR)/miniXmlParser.cpp'; then $(CYGPATH_W) '$(TOOLS_DIR)/miniXmlParser.cpp'; else $(CYGPATH_W) '$(srcdir)/$(TOOLS_DIR)/miniXmlParser.cpp'; fi`; \ | ||
| 799 | +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/miniXmlParser.Tpo" "$(DEPDIR)/miniXmlParser.Po"; else rm -f "$(DEPDIR)/miniXmlParser.Tpo"; exit 1; fi | ||
| 800 | +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(TOOLS_DIR)/miniXmlParser.cpp' object='miniXmlParser.obj' libtool=no @AMDEPBACKSLASH@ | ||
| 801 | +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ | ||
| 802 | +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o miniXmlParser.obj `if test -f '$(TOOLS_DIR)/miniXmlParser.cpp'; then $(CYGPATH_W) '$(TOOLS_DIR)/miniXmlParser.cpp'; else $(CYGPATH_W) '$(srcdir)/$(TOOLS_DIR)/miniXmlParser.cpp'; fi` | ||
| 803 | + | ||
| 804 | +xmlNode.o: $(TOOLS_DIR)/xmlNode.cpp | ||
| 805 | +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT xmlNode.o -MD -MP -MF "$(DEPDIR)/xmlNode.Tpo" -c -o xmlNode.o `test -f '$(TOOLS_DIR)/xmlNode.cpp' || echo '$(srcdir)/'`$(TOOLS_DIR)/xmlNode.cpp; \ | ||
| 806 | +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/xmlNode.Tpo" "$(DEPDIR)/xmlNode.Po"; else rm -f "$(DEPDIR)/xmlNode.Tpo"; exit 1; fi | ||
| 807 | +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(TOOLS_DIR)/xmlNode.cpp' object='xmlNode.o' libtool=no @AMDEPBACKSLASH@ | ||
| 808 | +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ | ||
| 809 | +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o xmlNode.o `test -f '$(TOOLS_DIR)/xmlNode.cpp' || echo '$(srcdir)/'`$(TOOLS_DIR)/xmlNode.cpp | ||
| 810 | + | ||
| 811 | +xmlNode.obj: $(TOOLS_DIR)/xmlNode.cpp | ||
| 812 | +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT xmlNode.obj -MD -MP -MF "$(DEPDIR)/xmlNode.Tpo" -c -o xmlNode.obj `if test -f '$(TOOLS_DIR)/xmlNode.cpp'; then $(CYGPATH_W) '$(TOOLS_DIR)/xmlNode.cpp'; else $(CYGPATH_W) '$(srcdir)/$(TOOLS_DIR)/xmlNode.cpp'; fi`; \ | ||
| 813 | +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/xmlNode.Tpo" "$(DEPDIR)/xmlNode.Po"; else rm -f "$(DEPDIR)/xmlNode.Tpo"; exit 1; fi | ||
| 814 | +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(TOOLS_DIR)/xmlNode.cpp' object='xmlNode.obj' libtool=no @AMDEPBACKSLASH@ | ||
| 815 | +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ | ||
| 816 | +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o xmlNode.obj `if test -f '$(TOOLS_DIR)/xmlNode.cpp'; then $(CYGPATH_W) '$(TOOLS_DIR)/xmlNode.cpp'; else $(CYGPATH_W) '$(srcdir)/$(TOOLS_DIR)/xmlNode.cpp'; fi` | ||
| 817 | + | ||
| 818 | +httpParser.o: $(TOOLS_DIR)/httpParser.cpp | ||
| 819 | +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT httpParser.o -MD -MP -MF "$(DEPDIR)/httpParser.Tpo" -c -o httpParser.o `test -f '$(TOOLS_DIR)/httpParser.cpp' || echo '$(srcdir)/'`$(TOOLS_DIR)/httpParser.cpp; \ | ||
| 820 | +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/httpParser.Tpo" "$(DEPDIR)/httpParser.Po"; else rm -f "$(DEPDIR)/httpParser.Tpo"; exit 1; fi | ||
| 821 | +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(TOOLS_DIR)/httpParser.cpp' object='httpParser.o' libtool=no @AMDEPBACKSLASH@ | ||
| 822 | +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ | ||
| 823 | +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o httpParser.o `test -f '$(TOOLS_DIR)/httpParser.cpp' || echo '$(srcdir)/'`$(TOOLS_DIR)/httpParser.cpp | ||
| 824 | + | ||
| 825 | +httpParser.obj: $(TOOLS_DIR)/httpParser.cpp | ||
| 826 | +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT httpParser.obj -MD -MP -MF "$(DEPDIR)/httpParser.Tpo" -c -o httpParser.obj `if test -f '$(TOOLS_DIR)/httpParser.cpp'; then $(CYGPATH_W) '$(TOOLS_DIR)/httpParser.cpp'; else $(CYGPATH_W) '$(srcdir)/$(TOOLS_DIR)/httpParser.cpp'; fi`; \ | ||
| 827 | +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/httpParser.Tpo" "$(DEPDIR)/httpParser.Po"; else rm -f "$(DEPDIR)/httpParser.Tpo"; exit 1; fi | ||
| 828 | +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(TOOLS_DIR)/httpParser.cpp' object='httpParser.obj' libtool=no @AMDEPBACKSLASH@ | ||
| 829 | +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ | ||
| 830 | +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o httpParser.obj `if test -f '$(TOOLS_DIR)/httpParser.cpp'; then $(CYGPATH_W) '$(TOOLS_DIR)/httpParser.cpp'; else $(CYGPATH_W) '$(srcdir)/$(TOOLS_DIR)/httpParser.cpp'; fi` | ||
| 831 | + | ||
| 832 | MEILinux.o: $(MEI_DIR)/MEILinux.cpp | ||
| 833 | @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT MEILinux.o -MD -MP -MF "$(DEPDIR)/MEILinux.Tpo" -c -o MEILinux.o `test -f '$(MEI_DIR)/MEILinux.cpp' || echo '$(srcdir)/'`$(MEI_DIR)/MEILinux.cpp; \ | ||
| 834 | @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/MEILinux.Tpo" "$(DEPDIR)/MEILinux.Po"; else rm -f "$(DEPDIR)/MEILinux.Tpo"; exit 1; fi | ||
| 835 | @@ -551,6 +664,23 @@ clean-libtool: | ||
| 836 | distclean-libtool: | ||
| 837 | -rm -f libtool | ||
| 838 | uninstall-info-am: | ||
| 839 | +install-xml_DATA: $(xml__DATA) | ||
| 840 | + @$(NORMAL_INSTALL) | ||
| 841 | + test -z "$(xml_dir)" || $(mkdir_p) "$(DESTDIR)$(xml_dir)" | ||
| 842 | + @list='$(xml__DATA)'; for p in $$list; do \ | ||
| 843 | + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ | ||
| 844 | + f=$(am__strip_dir) \ | ||
| 845 | + echo " $(xml_DATA_INSTALL) '$$d$$p' '$(DESTDIR)$(xml_dir)/$$f'"; \ | ||
| 846 | + $(xml_DATA_INSTALL) "$$d$$p" "$(DESTDIR)$(xml_dir)/$$f"; \ | ||
| 847 | + done | ||
| 848 | + | ||
| 849 | +uninstall-xml_DATA: | ||
| 850 | + @$(NORMAL_UNINSTALL) | ||
| 851 | + @list='$(xml__DATA)'; for p in $$list; do \ | ||
| 852 | + f=$(am__strip_dir) \ | ||
| 853 | + echo " rm -f '$(DESTDIR)$(xml_dir)/$$f'"; \ | ||
| 854 | + rm -f "$(DESTDIR)$(xml_dir)/$$f"; \ | ||
| 855 | + done | ||
| 856 | |||
| 857 | ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) | ||
| 858 | list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ | ||
| 859 | @@ -629,9 +759,9 @@ distdir: $(DISTFILES) | ||
| 860 | done | ||
| 861 | check-am: all-am | ||
| 862 | check: check-am | ||
| 863 | -all-am: Makefile $(PROGRAMS) | ||
| 864 | +all-am: Makefile $(PROGRAMS) $(SCRIPTS) $(DATA) | ||
| 865 | installdirs: | ||
| 866 | - for dir in "$(DESTDIR)$(sbindir)"; do \ | ||
| 867 | + for dir in "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(xml_dir)"; do \ | ||
| 868 | test -z "$$dir" || $(mkdir_p) "$$dir"; \ | ||
| 869 | done | ||
| 870 | install: install-am | ||
| 871 | @@ -679,11 +809,11 @@ info: info-am | ||
| 872 | |||
| 873 | info-am: | ||
| 874 | |||
| 875 | -install-data-am: | ||
| 876 | +install-data-am: install-xml_DATA | ||
| 877 | @$(NORMAL_INSTALL) | ||
| 878 | $(MAKE) $(AM_MAKEFLAGS) install-data-hook | ||
| 879 | |||
| 880 | -install-exec-am: install-sbinPROGRAMS | ||
| 881 | +install-exec-am: install-dist_binSCRIPTS install-sbinPROGRAMS | ||
| 882 | |||
| 883 | install-info: install-info-am | ||
| 884 | |||
| 885 | @@ -709,20 +839,22 @@ ps: ps-am | ||
| 886 | |||
| 887 | ps-am: | ||
| 888 | |||
| 889 | -uninstall-am: uninstall-info-am uninstall-sbinPROGRAMS | ||
| 890 | +uninstall-am: uninstall-dist_binSCRIPTS uninstall-info-am \ | ||
| 891 | + uninstall-sbinPROGRAMS uninstall-xml_DATA | ||
| 892 | |||
| 893 | .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ | ||
| 894 | clean-libtool clean-sbinPROGRAMS ctags distclean \ | ||
| 895 | distclean-compile distclean-generic distclean-libtool \ | ||
| 896 | distclean-tags distdir dvi dvi-am html html-am info info-am \ | ||
| 897 | install install-am install-data install-data-am \ | ||
| 898 | - install-data-hook install-exec install-exec-am install-info \ | ||
| 899 | - install-info-am install-man install-sbinPROGRAMS install-strip \ | ||
| 900 | + install-data-hook install-dist_binSCRIPTS install-exec \ | ||
| 901 | + install-exec-am install-info install-info-am install-man \ | ||
| 902 | + install-sbinPROGRAMS install-strip install-xml_DATA \ | ||
| 903 | installcheck installcheck-am installdirs maintainer-clean \ | ||
| 904 | maintainer-clean-generic mostlyclean mostlyclean-compile \ | ||
| 905 | mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ | ||
| 906 | - tags uninstall uninstall-am uninstall-info-am \ | ||
| 907 | - uninstall-sbinPROGRAMS | ||
| 908 | + tags uninstall uninstall-am uninstall-dist_binSCRIPTS \ | ||
| 909 | + uninstall-info-am uninstall-sbinPROGRAMS uninstall-xml_DATA | ||
| 910 | |||
| 911 | |||
| 912 | install-data-hook: | ||
| 913 | diff --git a/src/Makefile.inc b/src/Makefile.inc | ||
| 914 | index 079503c..8d7e7ab 100755 | ||
| 915 | --- a/src/Makefile.inc | ||
| 916 | +++ b/src/Makefile.inc | ||
| 917 | @@ -26,11 +26,19 @@ $(MEI_DIR)/PTHICommand.cpp | ||
| 918 | |||
| 919 | TOOLS_HDRS=$(TOOLS_DIR)/ATVersion.h \ | ||
| 920 | $(TOOLS_DIR)/ATNetworkTool.h \ | ||
| 921 | -$(TOOLS_DIR)/daemonize.h | ||
| 922 | +$(TOOLS_DIR)/daemonize.h \ | ||
| 923 | +$(TOOLS_DIR)/utils.h \ | ||
| 924 | +$(TOOLS_DIR)/miniXmlParser.h \ | ||
| 925 | +$(TOOLS_DIR)/xmlNode.h \ | ||
| 926 | +$(TOOLS_DIR)/httpParser.h | ||
| 927 | |||
| 928 | TOOLS_SRCS=$(TOOLS_DIR)/ATVersion.cpp \ | ||
| 929 | $(TOOLS_DIR)/ATNetworkTool.cpp \ | ||
| 930 | -$(TOOLS_DIR)/daemonize.cpp | ||
| 931 | +$(TOOLS_DIR)/daemonize.cpp \ | ||
| 932 | +$(TOOLS_DIR)/utils.cpp \ | ||
| 933 | +$(TOOLS_DIR)/miniXmlParser.cpp \ | ||
| 934 | +$(TOOLS_DIR)/xmlNode.cpp \ | ||
| 935 | +$(TOOLS_DIR)/httpParser.cpp | ||
| 936 | |||
| 937 | MAIN_HDRS=types.h \ | ||
| 938 | Channel.h \ | ||
| 939 | @@ -42,14 +50,18 @@ ConfigConnection.h \ | ||
| 940 | Protocol.h \ | ||
| 941 | glue.h \ | ||
| 942 | version.h \ | ||
| 943 | -ChannelGenerator.h | ||
| 944 | +ChannelGenerator.h \ | ||
| 945 | +alertIndication.h \ | ||
| 946 | +alertDescription.h | ||
| 947 | |||
| 948 | MAIN_SRCS=main.cpp \ | ||
| 949 | LMEConnection.cpp \ | ||
| 950 | ConfigConnection.cpp \ | ||
| 951 | Protocol.cpp \ | ||
| 952 | glue.cpp \ | ||
| 953 | -ChannelGenerator.cpp | ||
| 954 | +ChannelGenerator.cpp \ | ||
| 955 | +alertIndication.cpp \ | ||
| 956 | +alertDescription.cpp | ||
| 957 | |||
| 958 | SRCS=$(MAIN_SRCS) \ | ||
| 959 | $(TOOLS_SRCS) \ | ||
| 960 | diff --git a/src/Protocol.cpp b/src/Protocol.cpp | ||
| 961 | index 3a4a9bb..c3de5cc 100755 | ||
| 962 | --- a/src/Protocol.cpp | ||
| 963 | +++ b/src/Protocol.cpp | ||
| 964 | @@ -28,6 +28,7 @@ | ||
| 965 | * POSSIBILITY OF SUCH DAMAGE. | ||
| 966 | *******************************************************************************/ | ||
| 967 | |||
| 968 | + | ||
| 969 | #ifdef HAVE_CONFIG_H | ||
| 970 | #include "config.h" | ||
| 971 | #endif | ||
| 972 | @@ -42,7 +43,8 @@ | ||
| 973 | #include <fcntl.h> | ||
| 974 | #include <netdb.h> | ||
| 975 | #include <syslog.h> | ||
| 976 | -#include "strings.h" | ||
| 977 | +#include <vector> | ||
| 978 | +#include <string.h> | ||
| 979 | |||
| 980 | #define _stprintf_s snprintf | ||
| 981 | #define strnicmp strncasecmp | ||
| 982 | @@ -53,6 +55,11 @@ | ||
| 983 | #include "LMS_if.h" | ||
| 984 | #include "Lock.h" | ||
| 985 | #include "ATNetworkTool.h" | ||
| 986 | +#include "utils.h" | ||
| 987 | +#include "httpParser.h" | ||
| 988 | +#include "miniXmlParser.h" | ||
| 989 | +#include "alertIndication.h" | ||
| 990 | +#include "alertDescription.h" | ||
| 991 | |||
| 992 | |||
| 993 | const LMEProtocolVersionMessage Protocol::MIN_PROT_VERSION(1, 0); | ||
| 994 | @@ -99,9 +106,9 @@ bool Protocol::Init(EventLogCallback cb, void *param) | ||
| 995 | PRINT("Protocol::Init started\n"); | ||
| 996 | _eventLog = cb; | ||
| 997 | _eventLogParam = param; | ||
| 998 | + _UNSSenderChannel = INVALID_CHANNEL; | ||
| 999 | |||
| 1000 | DeinitFull(); | ||
| 1001 | - | ||
| 1002 | { | ||
| 1003 | Lock dl(_deinitLock); | ||
| 1004 | _deinitReq = false; | ||
| 1005 | @@ -1170,10 +1177,112 @@ void Protocol::_removeFromMaps(Channel *c) | ||
| 1006 | _channelToSocket.erase(c->GetSenderChannel()); | ||
| 1007 | _socketToChannel.erase(s); | ||
| 1008 | } | ||
| 1009 | -void Protocol::_UNSConnection() | ||
| 1010 | + | ||
| 1011 | +std::string Protocol::_PACKET_BODY_LENGTH="Content-Length"; | ||
| 1012 | +std::string Protocol::_NOTIFICATION_HEADER="Intel Management Engine Notification"; | ||
| 1013 | +int Protocol::_UNSHandler(char *data, int dataLength) | ||
| 1014 | { | ||
| 1015 | - PRINT("UNS event\n"); | ||
| 1016 | + PRINT("UNS event data\n"); | ||
| 1017 | + char *pBuffer = NULL; | ||
| 1018 | + static char *sBuffer = NULL; | ||
| 1019 | + static int sBufferLength = 0; | ||
| 1020 | + int rc = -1; | ||
| 1021 | + unsigned int packetBodyLength = 0; | ||
| 1022 | + HttpParser httpParser; | ||
| 1023 | + std::string httpBody; | ||
| 1024 | + AlertIndication alertIndication; | ||
| 1025 | + | ||
| 1026 | + //printf("Processing notification message %d\n", newNotification); | ||
| 1027 | + | ||
| 1028 | + //Init if new notification. Append recieved notification bytes to existing buffer otherwise. | ||
| 1029 | + if (_newNotification == true) | ||
| 1030 | + { if (sBuffer != NULL) { | ||
| 1031 | + delete []sBuffer; | ||
| 1032 | + } | ||
| 1033 | + sBuffer = NULL; | ||
| 1034 | + sBufferLength = 0; | ||
| 1035 | + } | ||
| 1036 | + | ||
| 1037 | + if (sBuffer == NULL) { | ||
| 1038 | + sBufferLength = 0; | ||
| 1039 | + sBuffer = new char[(dataLength+1) *sizeof(char)]; | ||
| 1040 | + memcpy(sBuffer, data, dataLength); | ||
| 1041 | + } else { | ||
| 1042 | + pBuffer = new char[(sBufferLength + dataLength + 1)*sizeof(char)]; | ||
| 1043 | + memcpy(pBuffer, sBuffer, sBufferLength); | ||
| 1044 | + memcpy(pBuffer+sBufferLength, data, dataLength); | ||
| 1045 | + delete []sBuffer; | ||
| 1046 | + sBuffer = pBuffer; | ||
| 1047 | + } | ||
| 1048 | + | ||
| 1049 | + sBufferLength += dataLength; | ||
| 1050 | + sBuffer[sBufferLength] = '\0'; | ||
| 1051 | + | ||
| 1052 | + do { | ||
| 1053 | + | ||
| 1054 | + if (httpParser.parse(sBuffer) != 0) { | ||
| 1055 | + break; | ||
| 1056 | + } | ||
| 1057 | + | ||
| 1058 | + if (httpParser.getHeaderField(_PACKET_BODY_LENGTH).empty()) { | ||
| 1059 | + break; | ||
| 1060 | + } | ||
| 1061 | + | ||
| 1062 | + packetBodyLength = stoi(httpParser.getHeaderField(_PACKET_BODY_LENGTH)); | ||
| 1063 | + | ||
| 1064 | + if (packetBodyLength == 0) { | ||
| 1065 | + break; | ||
| 1066 | + } | ||
| 1067 | + | ||
| 1068 | + httpBody = httpParser.getBody(); | ||
| 1069 | + if (httpBody.size() < packetBodyLength) { | ||
| 1070 | + break; | ||
| 1071 | + } | ||
| 1072 | + | ||
| 1073 | + if (alertIndication.initFromXml((char*)httpBody.c_str(), httpBody.size())) { | ||
| 1074 | + break; | ||
| 1075 | + } | ||
| 1076 | + | ||
| 1077 | + std::string alertIDString(alertIndication.getMessageID().data, alertIndication.getMessageID().dataLength); | ||
| 1078 | + if (alertIDString.empty()) { | ||
| 1079 | + break; | ||
| 1080 | + } | ||
| 1081 | + | ||
| 1082 | + /*Check if we have match only with ID, if fails then use MessageArguments and checkagain */ | ||
| 1083 | + std::string alertDescription; | ||
| 1084 | + std::string _alertDescription; | ||
| 1085 | + std::string notificationBody; | ||
| 1086 | + std::string messageArguments; | ||
| 1087 | + alertDescription = AlertDescription::getAlertDescription(alertIDString); | ||
| 1088 | + messageArguments = std::string(alertIndication.getMessageArguments().data, alertIndication.getMessageArguments().dataLength); | ||
| 1089 | + | ||
| 1090 | + if (alertDescription.empty()) { | ||
| 1091 | + alertIDString += "-" + messageArguments; | ||
| 1092 | + alertDescription = AlertDescription::getAlertDescription(alertIDString); | ||
| 1093 | + } else { | ||
| 1094 | + _alertDescription = messageArguments; | ||
| 1095 | + } | ||
| 1096 | + | ||
| 1097 | + notificationBody = std::string(alertIndication.getIndicationTime().data, alertIndication.getIndicationTime().dataLength); | ||
| 1098 | + if (alertDescription.empty()) { | ||
| 1099 | + notificationBody += " " + alertIDString; | ||
| 1100 | + } else { | ||
| 1101 | + if (_alertDescription.empty()) { | ||
| 1102 | + notificationBody += " " + alertDescription; | ||
| 1103 | + } else { | ||
| 1104 | + notificationBody += " : " + _alertDescription + " : " + alertDescription; | ||
| 1105 | + } | ||
| 1106 | + } | ||
| 1107 | + | ||
| 1108 | + Utils::notifyDesktop(_NOTIFICATION_HEADER, notificationBody, true); | ||
| 1109 | + rc = 0; | ||
| 1110 | + | ||
| 1111 | + } while(0); | ||
| 1112 | + | ||
| 1113 | + return rc; | ||
| 1114 | + | ||
| 1115 | } | ||
| 1116 | + | ||
| 1117 | int Protocol::_sendHostFQDN() | ||
| 1118 | { | ||
| 1119 | char localName[FQDN_MAX_SIZE] = "\0"; | ||
| 1120 | @@ -1195,12 +1304,15 @@ void Protocol::_apfChannelOpen(LMEChannelOpenRequestMessage *chOpenMsg, int *sta | ||
| 1121 | " Recipient channel %d for address %s, port %d.\n", | ||
| 1122 | chOpenMsg->SenderChannel, | ||
| 1123 | chOpenMsg->Address.c_str(), chOpenMsg->Port); | ||
| 1124 | + | ||
| 1125 | if(chOpenMsg->Port==0) | ||
| 1126 | { | ||
| 1127 | - _UNSConnection(); | ||
| 1128 | - _sendHostFQDN(); | ||
| 1129 | - return; | ||
| 1130 | + _UNSSenderChannel = chOpenMsg->SenderChannel; | ||
| 1131 | + _lme.ChannelOpenReplySuccess(_UNSSenderChannel, _UNSRecipientChannel); | ||
| 1132 | + _newNotification = true; | ||
| 1133 | + return; | ||
| 1134 | } | ||
| 1135 | + | ||
| 1136 | SOCKET s = ATNetworkTool::Connect(chOpenMsg->Address.c_str(), | ||
| 1137 | chOpenMsg->Port, error, PF_UNSPEC); | ||
| 1138 | if (s == INVALID_SOCKET) { | ||
| 1139 | @@ -1282,33 +1394,41 @@ PortForwardRequest *Protocol::_apfChannelClose(LMEChannelCloseMessage *chClMsg) | ||
| 1140 | Lock l(_channelsLock); | ||
| 1141 | PRINT("_apfChannelClose: RecipientChannel=%d\n",chClMsg->RecipientChannel); | ||
| 1142 | |||
| 1143 | - | ||
| 1144 | - ChannelToSocketMap::iterator it = _channelToSocket.find(chClMsg->RecipientChannel); | ||
| 1145 | - if (it != _channelToSocket .end()) | ||
| 1146 | - { | ||
| 1147 | - SOCKET s = it->second; | ||
| 1148 | - Channel *c = _socketToChannel[s]; | ||
| 1149 | - switch(c->GetStatus()) { | ||
| 1150 | - case Channel::OPEN: | ||
| 1151 | - c->SetStatus(Channel::CLOSED); | ||
| 1152 | - | ||
| 1153 | - _lme.ChannelClose(c->GetRecipientChannel(), c->GetSenderChannel()); | ||
| 1154 | - PRINT("Channel %d was closed by Intel AMT.\n", c->GetSenderChannel()); | ||
| 1155 | + do { | ||
| 1156 | + if (chClMsg->RecipientChannel == _UNSRecipientChannel) | ||
| 1157 | + { | ||
| 1158 | + //UNS event channel close. | ||
| 1159 | + //We have not created a channel on LMS side, hence ignore | ||
| 1160 | break; | ||
| 1161 | + } | ||
| 1162 | |||
| 1163 | - case Channel::WAITING_CLOSE: | ||
| 1164 | - PRINT("Received reply by Intel AMT on closing channel %d.\n", c->GetSenderChannel()); | ||
| 1165 | - break; | ||
| 1166 | + ChannelToSocketMap::iterator it = _channelToSocket.find(chClMsg->RecipientChannel); | ||
| 1167 | + if (it != _channelToSocket .end()) | ||
| 1168 | + { | ||
| 1169 | + SOCKET s = it->second; | ||
| 1170 | + Channel *c = _socketToChannel[s]; | ||
| 1171 | + switch(c->GetStatus()) { | ||
| 1172 | + case Channel::OPEN: | ||
| 1173 | + c->SetStatus(Channel::CLOSED); | ||
| 1174 | + | ||
| 1175 | + _lme.ChannelClose(c->GetRecipientChannel(), c->GetSenderChannel()); | ||
| 1176 | + PRINT("Channel %d was closed by Intel AMT.\n", c->GetSenderChannel()); | ||
| 1177 | + break; | ||
| 1178 | |||
| 1179 | - case Channel::CLOSED: | ||
| 1180 | - case Channel::NOT_OPENED: | ||
| 1181 | - break; | ||
| 1182 | - } | ||
| 1183 | + case Channel::WAITING_CLOSE: | ||
| 1184 | + PRINT("Received reply by Intel AMT on closing channel %d.\n", c->GetSenderChannel()); | ||
| 1185 | + break; | ||
| 1186 | |||
| 1187 | - _removeFromMaps(c); | ||
| 1188 | - clPFwdReq = _closeMChannel(c); | ||
| 1189 | + case Channel::CLOSED: | ||
| 1190 | + case Channel::NOT_OPENED: | ||
| 1191 | + break; | ||
| 1192 | + } | ||
| 1193 | + | ||
| 1194 | + _removeFromMaps(c); | ||
| 1195 | + clPFwdReq = _closeMChannel(c); | ||
| 1196 | |||
| 1197 | - } | ||
| 1198 | + } | ||
| 1199 | + } while(0); | ||
| 1200 | |||
| 1201 | _channelGenerator.FreeChannel(chClMsg->RecipientChannel); | ||
| 1202 | |||
| 1203 | @@ -1320,6 +1440,18 @@ PortForwardRequest *Protocol::_apfChannelData(LMEChannelDataMessage *chDMsg, int | ||
| 1204 | PortForwardRequest *clPFwdReq = NULL; | ||
| 1205 | |||
| 1206 | do { | ||
| 1207 | + if (chDMsg->RecipientChannel == _UNSRecipientChannel) | ||
| 1208 | + | ||
| 1209 | + { | ||
| 1210 | + if (_UNSHandler((char*)chDMsg->Data, chDMsg->DataLength) == 0) | ||
| 1211 | + { | ||
| 1212 | + _lme.ChannelClose(_UNSSenderChannel, _UNSRecipientChannel); | ||
| 1213 | + } | ||
| 1214 | + _newNotification = false; | ||
| 1215 | + //UNS event data handle. | ||
| 1216 | + //We have not created a channel on LMS side, hence break | ||
| 1217 | + break; | ||
| 1218 | + } | ||
| 1219 | Lock l(_channelsLock); | ||
| 1220 | |||
| 1221 | ChannelToSocketMap::iterator it = _channelToSocket.find(chDMsg->RecipientChannel); | ||
| 1222 | @@ -1341,6 +1473,7 @@ PortForwardRequest *Protocol::_apfChannelData(LMEChannelDataMessage *chDMsg, int | ||
| 1223 | int senderr = 0; | ||
| 1224 | int count = _send(channel->GetSocket(), (char *)chDMsg->Data, | ||
| 1225 | chDMsg->DataLength, senderr); | ||
| 1226 | + | ||
| 1227 | PRINT("Sent %d bytes of %d from Intel AMT to channel %d with socket %d.\n", | ||
| 1228 | count, chDMsg->DataLength, chDMsg->RecipientChannel, | ||
| 1229 | channel->GetSocket()); | ||
| 1230 | diff --git a/src/Protocol.h b/src/Protocol.h | ||
| 1231 | index a4ef419..858cb78 100755 | ||
| 1232 | --- a/src/Protocol.h | ||
| 1233 | +++ b/src/Protocol.h | ||
| 1234 | @@ -46,6 +46,7 @@ | ||
| 1235 | |||
| 1236 | #define SOCKET int | ||
| 1237 | #define INVALID_SOCKET (SOCKET)(~0) | ||
| 1238 | +#define INVALID_CHANNEL -1 | ||
| 1239 | #define SOCKET_ERROR (-1) | ||
| 1240 | |||
| 1241 | |||
| 1242 | @@ -120,7 +121,7 @@ private: | ||
| 1243 | PortForwardRequest *_apfChannelData(LMEChannelDataMessage *chDMsg, int *status); | ||
| 1244 | void _LmeReceive(void *buffer, unsigned int len, int *status); | ||
| 1245 | void _signalSelect(); | ||
| 1246 | - void _UNSConnection(); | ||
| 1247 | + int _UNSHandler(char *buffer, int len); | ||
| 1248 | bool _acceptConnection(SOCKET s, unsigned int port); | ||
| 1249 | int _rxFromSocket(SOCKET s); | ||
| 1250 | int _handleFQDNChange(const char *fqdn); | ||
| 1251 | @@ -192,6 +193,11 @@ private: | ||
| 1252 | typedef std::set<unsigned int> listenPortSet; | ||
| 1253 | listenPortSet _listenFailReported; | ||
| 1254 | ChannelGenerator _channelGenerator; | ||
| 1255 | + static const unsigned int _UNSRecipientChannel = 55555; | ||
| 1256 | + unsigned int _UNSSenderChannel; | ||
| 1257 | + bool _newNotification; | ||
| 1258 | + static std::string _PACKET_BODY_LENGTH; | ||
| 1259 | + static std::string _NOTIFICATION_HEADER; | ||
| 1260 | }; | ||
| 1261 | |||
| 1262 | #endif | ||
| 1263 | diff --git a/src/alertDescription.cpp b/src/alertDescription.cpp | ||
| 1264 | new file mode 100644 | ||
| 1265 | index 0000000..f05f940 | ||
| 1266 | --- /dev/null | ||
| 1267 | +++ b/src/alertDescription.cpp | ||
| 1268 | @@ -0,0 +1,144 @@ | ||
| 1269 | +/******************************************************************************* | ||
| 1270 | + * Copyright (C) 2017 Intel Corporation. All rights reserved. | ||
| 1271 | + * | ||
| 1272 | + * Redistribution and use in source and binary forms, with or without | ||
| 1273 | + * modification, are permitted provided that the following conditions are met: | ||
| 1274 | + * | ||
| 1275 | + * - Redistributions of source code must retain the above copyright notice, | ||
| 1276 | + * this list of conditions and the following disclaimer. | ||
| 1277 | + * | ||
| 1278 | + * - Redistributions in binary form must reproduce the above copyright notice, | ||
| 1279 | + * this list of conditions and the following disclaimer in the documentation | ||
| 1280 | + * and/or other materials provided with the distribution. | ||
| 1281 | + * | ||
| 1282 | + * - Neither the name of Intel Corporation. nor the names of its | ||
| 1283 | + * contributors may be used to endorse or promote products derived from this | ||
| 1284 | + * software without specific prior written permission. | ||
| 1285 | + * | ||
| 1286 | + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' | ||
| 1287 | + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 1288 | + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 1289 | + * ARE DISCLAIMED. IN NO EVENT SHALL Intel Corporation. OR THE CONTRIBUTORS | ||
| 1290 | + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
| 1291 | + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
| 1292 | + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
| 1293 | + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
| 1294 | + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 1295 | + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
| 1296 | + * POSSIBILITY OF SUCH DAMAGE. | ||
| 1297 | + *******************************************************************************/ | ||
| 1298 | +#include "alertDescription.h" | ||
| 1299 | +#include "miniXmlParser.h" | ||
| 1300 | +#include <sstream> | ||
| 1301 | +#include <fstream> | ||
| 1302 | +#include "defaultAlerts.h" | ||
| 1303 | +#include "types.h" | ||
| 1304 | + | ||
| 1305 | +bool AlertDescription::classInited = false; | ||
| 1306 | +std::string AlertDescription::alertXmlFile = "/usr/local/share/xml/AMTAlerts.xml"; | ||
| 1307 | +std::string AlertDescription::alertXmlFile1 = "/usr/share/xml/AMTAlerts.xml"; | ||
| 1308 | +std::map<std::string,std::string> AlertDescription::alertDescriptionMap; | ||
| 1309 | + | ||
| 1310 | +void AlertDescription::initAlertDescription() { | ||
| 1311 | + | ||
| 1312 | + char *value = NULL; | ||
| 1313 | + unsigned int valueLength = 0; | ||
| 1314 | + bool fromFile = false; | ||
| 1315 | + std::string alertIdArg; | ||
| 1316 | + std::stringstream ss; | ||
| 1317 | + std::string xmlData; | ||
| 1318 | + CDataLen id; | ||
| 1319 | + CDataLen arg; | ||
| 1320 | + CDataLen description; | ||
| 1321 | + MiniXmlParser xmlParser; | ||
| 1322 | + std::list<CDataLen>defaultAlertsList; | ||
| 1323 | + std::list<CDataLen>::iterator it; | ||
| 1324 | + | ||
| 1325 | + do { | ||
| 1326 | + if (classInited) { | ||
| 1327 | + break; | ||
| 1328 | + } | ||
| 1329 | + | ||
| 1330 | + std::ifstream is(alertXmlFile, std::ifstream::in); | ||
| 1331 | + if (is.good()) { | ||
| 1332 | + ss << is.rdbuf(); | ||
| 1333 | + xmlData = ss.str(); | ||
| 1334 | + fromFile = true; | ||
| 1335 | + } else { | ||
| 1336 | + std::ifstream _is(alertXmlFile1, std::ifstream::in); | ||
| 1337 | + if (_is.good()) { | ||
| 1338 | + ss << _is.rdbuf(); | ||
| 1339 | + xmlData = ss.str(); | ||
| 1340 | + fromFile = true; | ||
| 1341 | + } | ||
| 1342 | + _is.close(); | ||
| 1343 | + } | ||
| 1344 | + is.close(); | ||
| 1345 | + | ||
| 1346 | + /* Parse alert descriptions from xml file, if file is absent use the default ones */ | ||
| 1347 | + if (fromFile) { | ||
| 1348 | + /* From xml file */ | ||
| 1349 | + if (xmlParser.parse((char*)xmlData.c_str(), xmlData.size()) == 0) { | ||
| 1350 | + /* Process alert xml of form | ||
| 1351 | + * <Alerts><Alert><Id>iAMT0052</Id><Arg>1</Arg></Alert> <Alert>...</Alert> ...<Alerts> | ||
| 1352 | + */ | ||
| 1353 | + if (xmlParser.getXmlTagValue(xmlParser.getRootNode(), "Alerts", 6, NULL, 0, &value, &valueLength) == 0 ) { | ||
| 1354 | + while (xmlParser.getXmlTagValue(NULL, "Alert", 5, NULL, 0, &value, &valueLength) == 0) { | ||
| 1355 | + xmlParser.getXmlTagValue(NULL, "Id", 2, NULL, 0, &value, &valueLength); | ||
| 1356 | + id.data = value; | ||
| 1357 | + id.dataLength = valueLength; | ||
| 1358 | + | ||
| 1359 | + xmlParser.getXmlTagValue(NULL, "Arg", 3, NULL, 0, &value, &valueLength); | ||
| 1360 | + arg.data = value; | ||
| 1361 | + arg.dataLength = valueLength; | ||
| 1362 | + | ||
| 1363 | + alertIdArg = std::string(id.data, id.dataLength) + "-" + std::string(arg.data, arg.dataLength); | ||
| 1364 | + | ||
| 1365 | + xmlParser.getXmlTagValue(NULL, "Message", 7, NULL, 0, &value, &valueLength); | ||
| 1366 | + alertDescriptionMap.insert(std::pair<std::string, std::string>(alertIdArg, std::string(value, valueLength))); | ||
| 1367 | + } | ||
| 1368 | + classInited = true; | ||
| 1369 | + } | ||
| 1370 | + } else { | ||
| 1371 | + PRINT("Failed to parse XML\n"); | ||
| 1372 | + } | ||
| 1373 | + } else { | ||
| 1374 | + /* Using default XML alerts descriptions */ | ||
| 1375 | + defaultAlertsList = Utils::split(DEFAULT_ALERTS , DEFAULT_ALERTS_LENGTH , ";", 1); | ||
| 1376 | + for (CDataLen alert: defaultAlertsList) { | ||
| 1377 | + std::list<CDataLen> alertIdDescription = Utils::split(alert.data, alert.dataLength, ":", 1); | ||
| 1378 | + if (alertIdDescription.size() >= 2) { | ||
| 1379 | + it = alertIdDescription.begin(); | ||
| 1380 | + id.data = it->data; | ||
| 1381 | + id.dataLength = it->dataLength; | ||
| 1382 | + it++; | ||
| 1383 | + description.data = it->data; | ||
| 1384 | + description.dataLength = it->dataLength; | ||
| 1385 | + /* Add to std::map for faster retreival */ | ||
| 1386 | + alertDescriptionMap.insert(std::pair<std::string, std::string>(std::string(id.data, id.dataLength), | ||
| 1387 | + std::string(description.data, description.dataLength))); | ||
| 1388 | + } | ||
| 1389 | + } | ||
| 1390 | + classInited = true; | ||
| 1391 | + } | ||
| 1392 | + } while(0); | ||
| 1393 | +} | ||
| 1394 | + | ||
| 1395 | + | ||
| 1396 | +std::string AlertDescription::getAlertDescription(std::string alert) { | ||
| 1397 | + CDataLen alertDescription; | ||
| 1398 | + std::map<std::string, std::string>::iterator it; | ||
| 1399 | + | ||
| 1400 | + if (classInited == false) { | ||
| 1401 | + initAlertDescription(); | ||
| 1402 | + } | ||
| 1403 | + | ||
| 1404 | + if (classInited && alertDescriptionMap.empty() == false) { | ||
| 1405 | + it = alertDescriptionMap.find(alert); | ||
| 1406 | + if (it != alertDescriptionMap.end()) { | ||
| 1407 | + return it->second; | ||
| 1408 | + } | ||
| 1409 | + } | ||
| 1410 | + | ||
| 1411 | + return ""; | ||
| 1412 | +}; | ||
| 1413 | diff --git a/src/alertDescription.h b/src/alertDescription.h | ||
| 1414 | new file mode 100644 | ||
| 1415 | index 0000000..6413f2a | ||
| 1416 | --- /dev/null | ||
| 1417 | +++ b/src/alertDescription.h | ||
| 1418 | @@ -0,0 +1,45 @@ | ||
| 1419 | +/******************************************************************************* | ||
| 1420 | + * Copyright (C) 2017 Intel Corporation. All rights reserved. | ||
| 1421 | + * | ||
| 1422 | + * Redistribution and use in source and binary forms, with or without | ||
| 1423 | + * modification, are permitted provided that the following conditions are met: | ||
| 1424 | + * | ||
| 1425 | + * - Redistributions of source code must retain the above copyright notice, | ||
| 1426 | + * this list of conditions and the following disclaimer. | ||
| 1427 | + * | ||
| 1428 | + * - Redistributions in binary form must reproduce the above copyright notice, | ||
| 1429 | + * this list of conditions and the following disclaimer in the documentation | ||
| 1430 | + * and/or other materials provided with the distribution. | ||
| 1431 | + * | ||
| 1432 | + * - Neither the name of Intel Corporation. nor the names of its | ||
| 1433 | + * contributors may be used to endorse or promote products derived from this | ||
| 1434 | + * software without specific prior written permission. | ||
| 1435 | + * | ||
| 1436 | + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' | ||
| 1437 | + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 1438 | + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 1439 | + * ARE DISCLAIMED. IN NO EVENT SHALL Intel Corporation. OR THE CONTRIBUTORS | ||
| 1440 | + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
| 1441 | + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
| 1442 | + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
| 1443 | + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
| 1444 | + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 1445 | + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
| 1446 | + * POSSIBILITY OF SUCH DAMAGE. | ||
| 1447 | + *******************************************************************************/ | ||
| 1448 | +#ifndef _ALERTDESCRIPTION_H | ||
| 1449 | +#define _AlERTDESCRIPTION_H | ||
| 1450 | +#include "utils.h" | ||
| 1451 | +#include <string> | ||
| 1452 | +#include <map> | ||
| 1453 | +class AlertDescription { | ||
| 1454 | + protected: | ||
| 1455 | + static bool classInited; | ||
| 1456 | + static std::string alertXmlFile; | ||
| 1457 | + static std::string alertXmlFile1; | ||
| 1458 | + static void initAlertDescription(); | ||
| 1459 | + static std::map<std::string, std::string> alertDescriptionMap; | ||
| 1460 | + public: | ||
| 1461 | + static std::string getAlertDescription(std::string alert); | ||
| 1462 | +}; | ||
| 1463 | +#endif | ||
| 1464 | diff --git a/src/alertIndication.cpp b/src/alertIndication.cpp | ||
| 1465 | new file mode 100644 | ||
| 1466 | index 0000000..ed14abd | ||
| 1467 | --- /dev/null | ||
| 1468 | +++ b/src/alertIndication.cpp | ||
| 1469 | @@ -0,0 +1,90 @@ | ||
| 1470 | +/******************************************************************************* | ||
| 1471 | + * Copyright (C) 2017 Intel Corporation. All rights reserved. | ||
| 1472 | + * | ||
| 1473 | + * Redistribution and use in source and binary forms, with or without | ||
| 1474 | + * modification, are permitted provided that the following conditions are met: | ||
| 1475 | + * | ||
| 1476 | + * - Redistributions of source code must retain the above copyright notice, | ||
| 1477 | + * this list of conditions and the following disclaimer. | ||
| 1478 | + * | ||
| 1479 | + * - Redistributions in binary form must reproduce the above copyright notice, | ||
| 1480 | + * this list of conditions and the following disclaimer in the documentation | ||
| 1481 | + * and/or other materials provided with the distribution. | ||
| 1482 | + * | ||
| 1483 | + * - Neither the name of Intel Corporation. nor the names of its | ||
| 1484 | + * contributors may be used to endorse or promote products derived from this | ||
| 1485 | + * software without specific prior written permission. | ||
| 1486 | + * | ||
| 1487 | + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' | ||
| 1488 | + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 1489 | + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 1490 | + * ARE DISCLAIMED. IN NO EVENT SHALL Intel Corporation. OR THE CONTRIBUTORS | ||
| 1491 | + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
| 1492 | + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
| 1493 | + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
| 1494 | + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
| 1495 | + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 1496 | + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
| 1497 | + * POSSIBILITY OF SUCH DAMAGE. | ||
| 1498 | + *******************************************************************************/ | ||
| 1499 | +#include "miniXmlParser.h" | ||
| 1500 | +#include "alertIndication.h" | ||
| 1501 | +#include <string.h> | ||
| 1502 | + | ||
| 1503 | +const char* AlertIndication::CLASS_URI = "http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_AlertIndication"; | ||
| 1504 | +void AlertIndication::initAlertIndication(char *ns, unsigned int nsLen) { | ||
| 1505 | + | ||
| 1506 | + char *value = NULL; | ||
| 1507 | + unsigned int valueLen= 0; | ||
| 1508 | + | ||
| 1509 | + if (xmlParser.getXmlTagValue(xmlParser.getRootNode(), "MessageID", strlen("MessageID"), ns, nsLen, &value, &valueLen) == 0) { | ||
| 1510 | + messageID.data = value; | ||
| 1511 | + messageID.dataLength = valueLen; | ||
| 1512 | + } | ||
| 1513 | + | ||
| 1514 | + if (xmlParser.getXmlTagValue(xmlParser.getRootNode(), "MessageArguments", strlen("MessageArguments"), ns, nsLen, &value, &valueLen) == 0) { | ||
| 1515 | + messageArguments.data = value; | ||
| 1516 | + messageArguments.dataLength = valueLen; | ||
| 1517 | + } | ||
| 1518 | + | ||
| 1519 | + if (xmlParser.getXmlTagValue(xmlParser.getRootNode(), "IndicationTime", strlen("IndicationTime"), ns, nsLen, &value, &valueLen) == 0) { | ||
| 1520 | + if (xmlParser.getXmlTagValue(NULL, "Datetime", strlen("Datetime"), NULL, 0, &value, &valueLen) == 0) { | ||
| 1521 | + indicationTime.data = value; | ||
| 1522 | + indicationTime.dataLength = valueLen; | ||
| 1523 | + } | ||
| 1524 | + } | ||
| 1525 | +} | ||
| 1526 | + | ||
| 1527 | +int AlertIndication::initFromXml(char *buffer, unsigned int bufferLen) { | ||
| 1528 | + | ||
| 1529 | + char *nsPrefix = NULL; | ||
| 1530 | + int rc = 0; | ||
| 1531 | + unsigned int nsPrefixLen = 0; | ||
| 1532 | + | ||
| 1533 | + do { | ||
| 1534 | + if (buffer == NULL || bufferLen == 0) { | ||
| 1535 | + rc = -1; | ||
| 1536 | + break; | ||
| 1537 | + } | ||
| 1538 | + | ||
| 1539 | + if (xmlParser.parse(buffer, bufferLen)) { | ||
| 1540 | + rc = -1; | ||
| 1541 | + break; | ||
| 1542 | + } | ||
| 1543 | + | ||
| 1544 | + if (xmlParser.getNSPrefix(xmlParser.getRootNode(), (char*)CLASS_URI, CLASS_URI_LEN, &nsPrefix, &nsPrefixLen)) { | ||
| 1545 | + rc = -1; | ||
| 1546 | + break; | ||
| 1547 | + } | ||
| 1548 | + | ||
| 1549 | + initAlertIndication(nsPrefix, nsPrefixLen); | ||
| 1550 | + | ||
| 1551 | + } while(0); | ||
| 1552 | + | ||
| 1553 | + return rc; | ||
| 1554 | +} | ||
| 1555 | + | ||
| 1556 | +CDataLen AlertIndication::getMessageArguments() { return messageArguments; }; | ||
| 1557 | +CDataLen AlertIndication::getIndicationTime() { return indicationTime; }; | ||
| 1558 | +CDataLen AlertIndication::getMessageID() { return messageID; }; | ||
| 1559 | + | ||
| 1560 | diff --git a/src/alertIndication.h b/src/alertIndication.h | ||
| 1561 | new file mode 100644 | ||
| 1562 | index 0000000..cf6dc51 | ||
| 1563 | --- /dev/null | ||
| 1564 | +++ b/src/alertIndication.h | ||
| 1565 | @@ -0,0 +1,54 @@ | ||
| 1566 | +/******************************************************************************* | ||
| 1567 | + * Copyright (C) 2017 Intel Corporation. All rights reserved. | ||
| 1568 | + * | ||
| 1569 | + * Redistribution and use in source and binary forms, with or without | ||
| 1570 | + * modification, are permitted provided that the following conditions are met: | ||
| 1571 | + * | ||
| 1572 | + * - Redistributions of source code must retain the above copyright notice, | ||
| 1573 | + * this list of conditions and the following disclaimer. | ||
| 1574 | + * | ||
| 1575 | + * - Redistributions in binary form must reproduce the above copyright notice, | ||
| 1576 | + * this list of conditions and the following disclaimer in the documentation | ||
| 1577 | + * and/or other materials provided with the distribution. | ||
| 1578 | + * | ||
| 1579 | + * - Neither the name of Intel Corporation. nor the names of its | ||
| 1580 | + * contributors may be used to endorse or promote products derived from this | ||
| 1581 | + * software without specific prior written permission. | ||
| 1582 | + * | ||
| 1583 | + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' | ||
| 1584 | + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 1585 | + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 1586 | + * ARE DISCLAIMED. IN NO EVENT SHALL Intel Corporation. OR THE CONTRIBUTORS | ||
| 1587 | + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
| 1588 | + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
| 1589 | + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
| 1590 | + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
| 1591 | + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 1592 | + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
| 1593 | + * POSSIBILITY OF SUCH DAMAGE. | ||
| 1594 | + *******************************************************************************/ | ||
| 1595 | +#ifndef __ALERTINDICATION_H | ||
| 1596 | +#define __ALERTINDICATION_H | ||
| 1597 | + | ||
| 1598 | +#include "utils.h" | ||
| 1599 | +#include <map> | ||
| 1600 | + | ||
| 1601 | +class AlertIndication { | ||
| 1602 | + private: | ||
| 1603 | + MiniXmlParser xmlParser; | ||
| 1604 | + CDataLen messageArguments; | ||
| 1605 | + CDataLen indicationTime; | ||
| 1606 | + CDataLen messageID; | ||
| 1607 | + void initAlertIndication(char *ns, unsigned int nsLen); | ||
| 1608 | + | ||
| 1609 | + public: | ||
| 1610 | + static const char* CLASS_URI; | ||
| 1611 | + static const int CLASS_URI_LEN = 69; | ||
| 1612 | + int initFromXml(char *buffer, unsigned int bufferLen); | ||
| 1613 | + CDataLen getMessageArguments(); | ||
| 1614 | + CDataLen getMessageID(); | ||
| 1615 | + CDataLen getIndicationTime(); | ||
| 1616 | + | ||
| 1617 | +}; | ||
| 1618 | + | ||
| 1619 | +#endif | ||
| 1620 | diff --git a/src/defaultAlerts.h b/src/defaultAlerts.h | ||
| 1621 | new file mode 100644 | ||
| 1622 | index 0000000..23283f8 | ||
| 1623 | --- /dev/null | ||
| 1624 | +++ b/src/defaultAlerts.h | ||
| 1625 | @@ -0,0 +1,43 @@ | ||
| 1626 | +#ifndef _DEFAULTALERTS_H | ||
| 1627 | +#define _DEFAULTALERTS_H | ||
| 1628 | +#define DEFAULT_ALERTS_LENGTH 6257 | ||
| 1629 | +#define DEFAULT_ALERTS "iAMT0001-:System Defense Policy triggered.;iAMT0002-:Agent Presence Agent not started.;iAMT0003-:Agent Presence Agent stopped.;iAMT0004-:Agent Presence: running.;\ | ||
| 1630 | +iAMT0005-:Agent Presence: expired.;iAMT0006-:Agent Presence: suspended.;iAMT0007-:Host software attempt to disable AMT Network link detected.;\ | ||
| 1631 | +iAMT0008-:Host software attempt to disable AMT Network link detected -- Host Network link blocked.;iAMT0009-:AMT clock or FLASH wear-out protection disabled.;\ | ||
| 1632 | +iAMT0010-:Intel(R) AMT Network Interface: Heuristics defense slow threshold trespassed.;iAMT0011-:Intel(R) AMT Network Interface: Heuristics defense fast threshold trespassed.;\ | ||
| 1633 | +iAMT0012-:Intel(R) AMT Network Interface: Heuristics defense factory defined threshold trespassed.;iAMT0013-:Intel(R) AMT Network Interface: Heuristics defense Encounter timeout expired.;\ | ||
| 1634 | +iAMT0014-:General certificate error.;iAMT0015-:Certificate expired.;iAMT0016-:No trusted root certificate.;iAMT0017-:Not configured to work with server certificate.;iAMT0018-:Certificate revoked.;\ | ||
| 1635 | +iAMT0019-:RSA exponent too large.;iAMT0020-:RSA modulus too large.;iAMT0021-:Unsupported digest.;iAMT0022-:Distinguished name too long.;iAMT0023-:Key usage missing.;\ | ||
| 1636 | +iAMT0024-:General SSL handshake error.;iAMT0025-:General 802.1x error.;iAMT0026-:AMT Diagnostic AlertEAC error - General NAC error.;\ | ||
| 1637 | +iAMT0027-:AMT Diagnostic AlertEAC error - attempt to get a NAC posture while AMT NAC is disabled.;iAMT0028-:AMT Diagnostic AlertEAC error - attempt to get a posture of an unsupported type.;\ | ||
| 1638 | +iAMT0029-:Audit log storage is 50% full.;iAMT0030-:Audit log storage is 75% full.;iAMT0031-:Audit log storage is 85% full.;iAMT0032-:Audit log storage is 95% full.;\ | ||
| 1639 | +iAMT0033-:Audit log storage is full.;iAMT0034-:Firmware Update Event - Partial.;iAMT0035-:Firmware Update Event - Failure.;iAMT0036-:Remote connectivity initiated.;\ | ||
| 1640 | +iAMT0037-:ME Presence event.;iAMT0038-0:AMT is being unprovisioned using BIOS command.;iAMT0038-1:AMT is being unprovisioned using Local MEI command.;\ | ||
| 1641 | +iAMT0038-2:AMT is being unprovisioned using Local WS-MAN/SOAP command.;iAMT0038-3:AMT is being unprovisioned using Remote WS-MAN/SOAP command.;\ | ||
| 1642 | +iAMT0050-:User Notification Alert - General Notification.;iAMT0050-16:User Notification Alert - Circuit Breaker notification (CB Drop TX filter hit.).;\ | ||
| 1643 | +iAMT0050-17:User Notification Alert - Circuit Breaker notification (CB Rate Limit TX filter hit.).;iAMT0050-18:User Notification Alert - Circuit Breaker notification (CB Drop RX filter hit.).;\ | ||
| 1644 | +iAMT0050-19:User Notification Alert - Circuit Breaker notification (CB Rate Limit RX filter hit.).;iAMT0050-32:User Notification Alert - EAC notification.;\ | ||
| 1645 | +iAMT0050-48:User Notification Alert - Remote diagnostics - (Remote Redirection session started - SOL).;iAMT0050-49:User Notification Alert - Remote diagnostics - (Remote Redirection session stopped - SOL).;\ | ||
| 1646 | +iAMT0050-50:User Notification Alert - Remote diagnostics. (Remote Redirection session started - IDE-R).;iAMT0050-51:User Notification Alert - Remote diagnostics. (Remote Redirection session stopped - IDE-R).;\ | ||
| 1647 | +iAMT0050-66:User Notification Alert - WLAN notification (Host profile mismatch - Management Interface ignored).;\ | ||
| 1648 | +iAMT0050-67:User Notification Alert - WLAN notification (Management device overrides host radio).;iAMT0050-68:User Notification Alert - WLAN notification (Host profile security mismatch).;\ | ||
| 1649 | +iAMT0050-69:User Notification Alert - WLAN notification (Management device relinquishes control over host Radio).;iAMT0051-:User Notification Alert - SecIo event.;\ | ||
| 1650 | +iAMT0051-0:User Notification Alert - SecIo event semaphore at host.;iAMT0051-1:User Notification Alert - semaphore at ME.;iAMT0051-2:User Notification Alert - SecIo event - semaphore timeout.;\ | ||
| 1651 | +iAMT0052-:User Notification Alert - KVM session event.;iAMT0052-0:User Notification Alert - KVM session requested.;iAMT0052-1:User Notification Alert - KVM session started.;\ | ||
| 1652 | +iAMT0052-2:User Notification Alert - KVM session stopped.;iAMT0053-:User Notification Alert - RCS notification.;\ | ||
| 1653 | +iAMT0053-50:User Notification Alert - RCS notification (HW button pressed. Connection initiated automatically).;\ | ||
| 1654 | +iAMT0053-52:User Notification Alert - RCS notification (HW button pressed. Connection wasn't initiated automatically).;iAMT0053-53:User Notification Alert - RCS notification (Contracts updated).;\ | ||
| 1655 | +iAMT0054-:User Notification Alert - WLAN notification. Wireless Profile sync enablement state changed.;iAMT0055-:User Notification Alert - Provisioning state change notification.;\ | ||
| 1656 | +iAMT0055-0:User Notification Alert - Provisioning state change notification - Pre-configuration.;iAMT0055-1:User Notification Alert - Provisioning state change notification - In configuration.;\ | ||
| 1657 | +iAMT0055-2:User Notification Alert - Provisioning state change notification - Post-configuration.;\ | ||
| 1658 | +iAMT0055-3:User Notification Alert - Provisioning state change notification - unprovision process has started.;iAMT0056-:User Notification Alert - System Defense change notification.;\ | ||
| 1659 | +iAMT0057-:User Notification Alert - Network State change notification.;iAMT0058-:User Notification Alert - Remote Access change notification.;\ | ||
| 1660 | +iAMT0058-1:User Notification Alert - Remote Access change notification - tunnel is closed.;iAMT0058-1:User Notification Alert - Remote Access change notification - tunnel is open.;\ | ||
| 1661 | +iAMT0059-:User Notification Alert - KVM enabled event.;iAMT0059-0:User Notification Alert - KVM enabled event - KVM disabled.;\ | ||
| 1662 | +iAMT0059-1:User Notification Alert - KVM enabled event - KVM enabled (both from MEBx and PTNI).;iAMT0060-:User Notification Alert - SecIO configuration event.;iAMT0061-:ME FW reset occurred.;\ | ||
| 1663 | +iAMT0062-:User Notification Alert - IpSyncEnabled event.;iAMT0062-0:User Notification Alert - IpSyncEnabled event - IpSync disabled.;\ | ||
| 1664 | +iAMT0062-1:User Notification Alert - IpSyncEnabled event - IpSync enabled.;iAMT0063-:User Notification Alert - HTTP Proxy sync enabled event.;\ | ||
| 1665 | +iAMT0063-0:User Notification Alert - HTTP Proxy sync enabled event - HTTP Proxy Sync disabled.;iAMT0063-1:User Notification Alert - HTTP Proxy sync enabled event - HTTP Proxy Sync enabled.;\ | ||
| 1666 | +iAMT0064-:User Notification Alert - User Consent event.;iAMT0064-1:User Notification Alert - User Consent event - User Consent granted.;\ | ||
| 1667 | +iAMT0064-2:User Notification Alert - User Consent event - User Consent ended.;" | ||
| 1668 | +#endif | ||
| 1669 | diff --git a/src/notifyDesktop.sh b/src/notifyDesktop.sh | ||
| 1670 | new file mode 100644 | ||
| 1671 | index 0000000..06bfd97 | ||
| 1672 | --- /dev/null | ||
| 1673 | +++ b/src/notifyDesktop.sh | ||
| 1674 | @@ -0,0 +1,10 @@ | ||
| 1675 | +#!/bin/sh | ||
| 1676 | +# get list of current users | ||
| 1677 | +for x in $(who | sort -u -k1,1 | awk '{print $1}'); do | ||
| 1678 | + # send message to anyone on display 0 | ||
| 1679 | + dbus_session_file=$(eval echo "~$x")/.dbus/session-bus/$(cat /var/lib/dbus/machine-id)-0 | ||
| 1680 | + if [ -e "$dbus_session_file" ]; then | ||
| 1681 | + su -l "$x" -c "source '$dbus_session_file'; export DISPLAY=:0; notify-send -u critical -t 2000 '$1' '$2'" | ||
| 1682 | + fi | ||
| 1683 | +done | ||
| 1684 | + | ||
| 1685 | diff --git a/src/tools/httpParser.cpp b/src/tools/httpParser.cpp | ||
| 1686 | new file mode 100644 | ||
| 1687 | index 0000000..38d2901 | ||
| 1688 | --- /dev/null | ||
| 1689 | +++ b/src/tools/httpParser.cpp | ||
| 1690 | @@ -0,0 +1,101 @@ | ||
| 1691 | +/******************************************************************************* | ||
| 1692 | + * Copyright (C) 2017 Intel Corporation. All rights reserved. | ||
| 1693 | + * | ||
| 1694 | + * Redistribution and use in source and binary forms, with or without | ||
| 1695 | + * modification, are permitted provided that the following conditions are met: | ||
| 1696 | + * | ||
| 1697 | + * - Redistributions of source code must retain the above copyright notice, | ||
| 1698 | + * this list of conditions and the following disclaimer. | ||
| 1699 | + * | ||
| 1700 | + * - Redistributions in binary form must reproduce the above copyright notice, | ||
| 1701 | + * this list of conditions and the following disclaimer in the documentation | ||
| 1702 | + * and/or other materials provided with the distribution. | ||
| 1703 | + * | ||
| 1704 | + * - Neither the name of Intel Corporation. nor the names of its | ||
| 1705 | + * contributors may be used to endorse or promote products derived from this | ||
| 1706 | + * software without specific prior written permission. | ||
| 1707 | + * | ||
| 1708 | + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' | ||
| 1709 | + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 1710 | + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 1711 | + * ARE DISCLAIMED. IN NO EVENT SHALL Intel Corporation. OR THE CONTRIBUTORS | ||
| 1712 | + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
| 1713 | + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
| 1714 | + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
| 1715 | + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
| 1716 | + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 1717 | + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
| 1718 | + * POSSIBILITY OF SUCH DAMAGE. | ||
| 1719 | + *******************************************************************************/ | ||
| 1720 | +#include "httpParser.h" | ||
| 1721 | +#include "utils.h" | ||
| 1722 | +#include "types.h" | ||
| 1723 | + | ||
| 1724 | +int HttpParser::parse(char *buffer) { | ||
| 1725 | + | ||
| 1726 | + std::vector<std::string> headerBody; | ||
| 1727 | + std::vector<std::string> header; | ||
| 1728 | + int rc = 0; | ||
| 1729 | + do { | ||
| 1730 | + if (buffer == NULL) { | ||
| 1731 | + rc = -1; | ||
| 1732 | + break; | ||
| 1733 | + } | ||
| 1734 | + | ||
| 1735 | + headerBody = Utils::split(buffer, "\r\n\r\n"); | ||
| 1736 | + if (headerBody.size() < 2) | ||
| 1737 | + { | ||
| 1738 | + PRINT("Failed to process httpHeader\n"); | ||
| 1739 | + rc = -1; | ||
| 1740 | + break; | ||
| 1741 | + } | ||
| 1742 | + | ||
| 1743 | + /* Entries in Header are seperated by \r\n */ | ||
| 1744 | + header = Utils::split((char*)headerBody[0].c_str(), "\r\n"); | ||
| 1745 | + | ||
| 1746 | + /* First line in header is the the header line | ||
| 1747 | + * e.g. POST <path> HTTP/1.1 | ||
| 1748 | + * e.g GET <path> HTTP/1.1 | ||
| 1749 | + */ | ||
| 1750 | + headerLine = header[0]; | ||
| 1751 | + | ||
| 1752 | + /* After headerline are the Fields | ||
| 1753 | + * e.g Content-Length:2204 | ||
| 1754 | + */ | ||
| 1755 | + for (unsigned int i=1; i< header.size(); i++) { | ||
| 1756 | + std::vector<std::string> field = Utils::split((char*)header[i].c_str(), ":"); | ||
| 1757 | + if (field.size() < 2) { | ||
| 1758 | + rc = -1; | ||
| 1759 | + break; | ||
| 1760 | + } | ||
| 1761 | + headerFields.insert(std::pair<std::string, std::string>(field[0], field[1])); | ||
| 1762 | + } | ||
| 1763 | + | ||
| 1764 | + if (rc) break; | ||
| 1765 | + | ||
| 1766 | + body = headerBody[1]; | ||
| 1767 | + } while(0); | ||
| 1768 | + | ||
| 1769 | + return rc; | ||
| 1770 | +} | ||
| 1771 | + | ||
| 1772 | +std::string HttpParser::getHeaderLine() { | ||
| 1773 | + return headerLine; | ||
| 1774 | +} | ||
| 1775 | + | ||
| 1776 | +std::string HttpParser::getHeaderField(std::string field) { | ||
| 1777 | + std::map<std::string,std::string>::iterator it; | ||
| 1778 | + std::string fieldValue = ""; | ||
| 1779 | + | ||
| 1780 | + it = headerFields.find(field); | ||
| 1781 | + if (it != headerFields.end()) | ||
| 1782 | + { | ||
| 1783 | + fieldValue = it->second; | ||
| 1784 | + } | ||
| 1785 | + | ||
| 1786 | + return fieldValue; | ||
| 1787 | +} | ||
| 1788 | + | ||
| 1789 | +std::string HttpParser::getBody() { | ||
| 1790 | + return body; | ||
| 1791 | +} | ||
| 1792 | diff --git a/src/tools/httpParser.h b/src/tools/httpParser.h | ||
| 1793 | new file mode 100644 | ||
| 1794 | index 0000000..a82d82a | ||
| 1795 | --- /dev/null | ||
| 1796 | +++ b/src/tools/httpParser.h | ||
| 1797 | @@ -0,0 +1,49 @@ | ||
| 1798 | +/******************************************************************************* | ||
| 1799 | + * Copyright (C) 2017 Intel Corporation. All rights reserved. | ||
| 1800 | + * | ||
| 1801 | + * Redistribution and use in source and binary forms, with or without | ||
| 1802 | + * modification, are permitted provided that the following conditions are met: | ||
| 1803 | + * | ||
| 1804 | + * - Redistributions of source code must retain the above copyright notice, | ||
| 1805 | + * this list of conditions and the following disclaimer. | ||
| 1806 | + * | ||
| 1807 | + * - Redistributions in binary form must reproduce the above copyright notice, | ||
| 1808 | + * this list of conditions and the following disclaimer in the documentation | ||
| 1809 | + * and/or other materials provided with the distribution. | ||
| 1810 | + * | ||
| 1811 | + * - Neither the name of Intel Corporation. nor the names of its | ||
| 1812 | + * contributors may be used to endorse or promote products derived from this | ||
| 1813 | + * software without specific prior written permission. | ||
| 1814 | + * | ||
| 1815 | + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' | ||
| 1816 | + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 1817 | + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 1818 | + * ARE DISCLAIMED. IN NO EVENT SHALL Intel Corporation. OR THE CONTRIBUTORS | ||
| 1819 | + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
| 1820 | + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
| 1821 | + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
| 1822 | + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
| 1823 | + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 1824 | + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
| 1825 | + * POSSIBILITY OF SUCH DAMAGE. | ||
| 1826 | + *******************************************************************************/ | ||
| 1827 | +#ifndef _HTTPPARSER_H | ||
| 1828 | +#define _HTTPPARSER_H | ||
| 1829 | +#include <vector> | ||
| 1830 | +#include <map> | ||
| 1831 | +#include <string> | ||
| 1832 | + | ||
| 1833 | +class HttpParser { | ||
| 1834 | + | ||
| 1835 | + public: | ||
| 1836 | + int parse(char *buffer); | ||
| 1837 | + std::string getHeaderLine(); | ||
| 1838 | + std::string getHeaderField(std::string field); | ||
| 1839 | + std::string getBody(); | ||
| 1840 | + private: | ||
| 1841 | + std::string headerLine; | ||
| 1842 | + std::map<std::string, std::string> headerFields; | ||
| 1843 | + std::string body; | ||
| 1844 | + | ||
| 1845 | +}; | ||
| 1846 | +#endif | ||
| 1847 | diff --git a/src/tools/miniXmlParser.cpp b/src/tools/miniXmlParser.cpp | ||
| 1848 | new file mode 100644 | ||
| 1849 | index 0000000..f1f0503 | ||
| 1850 | --- /dev/null | ||
| 1851 | +++ b/src/tools/miniXmlParser.cpp | ||
| 1852 | @@ -0,0 +1,375 @@ | ||
| 1853 | +/******************************************************************************* | ||
| 1854 | + * Copyright (C) 2017 Intel Corporation. All rights reserved. | ||
| 1855 | + * | ||
| 1856 | + * Redistribution and use in source and binary forms, with or without | ||
| 1857 | + * modification, are permitted provided that the following conditions are met: | ||
| 1858 | + * | ||
| 1859 | + * - Redistributions of source code must retain the above copyright notice, | ||
| 1860 | + * this list of conditions and the following disclaimer. | ||
| 1861 | + * | ||
| 1862 | + * - Redistributions in binary form must reproduce the above copyright notice, | ||
| 1863 | + * this list of conditions and the following disclaimer in the documentation | ||
| 1864 | + * and/or other materials provided with the distribution. | ||
| 1865 | + * | ||
| 1866 | + * - Neither the name of Intel Corporation. nor the names of its | ||
| 1867 | + * contributors may be used to endorse or promote products derived from this | ||
| 1868 | + * software without specific prior written permission. | ||
| 1869 | + * | ||
| 1870 | + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' | ||
| 1871 | + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 1872 | + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 1873 | + * ARE DISCLAIMED. IN NO EVENT SHALL Intel Corporation. OR THE CONTRIBUTORS | ||
| 1874 | + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
| 1875 | + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
| 1876 | + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
| 1877 | + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
| 1878 | + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 1879 | + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
| 1880 | + * POSSIBILITY OF SUCH DAMAGE. | ||
| 1881 | + *******************************************************************************/ | ||
| 1882 | +#include "miniXmlParser.h" | ||
| 1883 | +#include "utils.h" | ||
| 1884 | +#include <string.h> | ||
| 1885 | +#include <list> | ||
| 1886 | +#include <stack> | ||
| 1887 | +#include "types.h" | ||
| 1888 | + | ||
| 1889 | +MiniXmlParser::MiniXmlParser() { | ||
| 1890 | + rootNode = NULL; | ||
| 1891 | +} | ||
| 1892 | + | ||
| 1893 | +MiniXmlParser::~MiniXmlParser() { | ||
| 1894 | + if (rootNode) { | ||
| 1895 | + deleteXmlTree(rootNode); | ||
| 1896 | + rootNode = NULL; | ||
| 1897 | + } | ||
| 1898 | +} | ||
| 1899 | + | ||
| 1900 | +void MiniXmlParser::deleteXmlTree(XMLNode* rootNode) { | ||
| 1901 | + XMLNode* node = rootNode; | ||
| 1902 | + XMLNode* tempNode = NULL; | ||
| 1903 | + | ||
| 1904 | + while (node != NULL) { | ||
| 1905 | + tempNode = node->childNode; | ||
| 1906 | + delete node; | ||
| 1907 | + node = tempNode; | ||
| 1908 | + } | ||
| 1909 | +} | ||
| 1910 | + | ||
| 1911 | +int MiniXmlParser::validateXML(XMLNode const* rootNode) { | ||
| 1912 | + int rc = 0; | ||
| 1913 | + XMLNode* current = (XMLNode *)rootNode; | ||
| 1914 | + XMLNode* temp = NULL; | ||
| 1915 | + std::stack<XMLNode*> tagStack; | ||
| 1916 | + | ||
| 1917 | + while (current != NULL) { | ||
| 1918 | + if (current->tagName == NULL) { | ||
| 1919 | + PRINT("ValidateXML failed, foung a empty tag\n"); | ||
| 1920 | + rc = -1; | ||
| 1921 | + break; | ||
| 1922 | + } | ||
| 1923 | + | ||
| 1924 | + if (memcmp(current->tagName, "!", 1) == 0) { | ||
| 1925 | + temp = current; | ||
| 1926 | + current = tagStack.empty()?NULL:tagStack.top(); | ||
| 1927 | + if (current != NULL) { | ||
| 1928 | + current->childNode = temp->childNode; | ||
| 1929 | + } else { | ||
| 1930 | + current = temp; | ||
| 1931 | + } | ||
| 1932 | + } else if (current->startTag) { | ||
| 1933 | + current->parentNode = tagStack.empty()?NULL:tagStack.top(); | ||
| 1934 | + tagStack.push(current); | ||
| 1935 | + } else { | ||
| 1936 | + if (tagStack.empty() == false) { | ||
| 1937 | + temp = tagStack.top(); | ||
| 1938 | + tagStack.pop(); | ||
| 1939 | + } else { | ||
| 1940 | + temp = NULL; | ||
| 1941 | + } | ||
| 1942 | + if (temp != NULL) { | ||
| 1943 | + if (temp->tagLength == current->tagLength && memcmp(temp->tagName, current->tagName, current->tagLength) == 0) { | ||
| 1944 | + if (current->childNode != NULL) { | ||
| 1945 | + if (current->childNode->startTag != 0) { | ||
| 1946 | + temp->siblingNode = current->childNode; | ||
| 1947 | + } | ||
| 1948 | + } | ||
| 1949 | + temp->closingTag = current; | ||
| 1950 | + current->startingTag = temp; | ||
| 1951 | + } else { | ||
| 1952 | + PRINT("ValidateXML failed, Illegal tag\n"); | ||
| 1953 | + rc = -1; | ||
| 1954 | + break; | ||
| 1955 | + } | ||
| 1956 | + } else { | ||
| 1957 | + PRINT("ValidateXML failed, Illegal closing tag\n"); | ||
| 1958 | + rc = -1; | ||
| 1959 | + break; | ||
| 1960 | + } | ||
| 1961 | + } | ||
| 1962 | + current = current->childNode; | ||
| 1963 | + } | ||
| 1964 | + | ||
| 1965 | + if (tagStack.empty() == false) { | ||
| 1966 | + PRINT("ValidateXML failed, Incomplete XML\n"); | ||
| 1967 | + rc = -1; | ||
| 1968 | + } | ||
| 1969 | + | ||
| 1970 | + return rc; | ||
| 1971 | +} | ||
| 1972 | + | ||
| 1973 | +int MiniXmlParser::parse(char* buffer, unsigned int bufferLength) { | ||
| 1974 | + int validXml = -1; | ||
| 1975 | + XMLNode* node = NULL; | ||
| 1976 | + | ||
| 1977 | + node = _parse(buffer, bufferLength); | ||
| 1978 | + if (node) { | ||
| 1979 | + validXml = validateXML(node); | ||
| 1980 | + } | ||
| 1981 | + rootNode = node; | ||
| 1982 | + return validXml; | ||
| 1983 | +} | ||
| 1984 | + | ||
| 1985 | +XMLNode* MiniXmlParser::_parse(char const* buffer, unsigned int bufferLength) { | ||
| 1986 | + | ||
| 1987 | + char* tagName = NULL; | ||
| 1988 | + char* nsTag = NULL; | ||
| 1989 | + char* CommentEnd = NULL; | ||
| 1990 | + | ||
| 1991 | + int tagLength = 0; | ||
| 1992 | + int startTag = 0; | ||
| 1993 | + int emptyTag = 0; | ||
| 1994 | + int nsLength = 0; | ||
| 1995 | + int i = 0; | ||
| 1996 | + int CommentIndex = 0; | ||
| 1997 | + | ||
| 1998 | + std::list<CDataLen> xmlFields; | ||
| 1999 | + std::list<CDataLen> temp2; | ||
| 2000 | + std::list<CDataLen> tagValue; | ||
| 2001 | + | ||
| 2002 | + XMLNode *rootNode = NULL;; | ||
| 2003 | + XMLNode *current = NULL; | ||
| 2004 | + XMLNode *newNode = NULL; | ||
| 2005 | + std::list<CDataLen>::iterator it; | ||
| 2006 | + | ||
| 2007 | + if (buffer == NULL || bufferLength == 0) { | ||
| 2008 | + return NULL; | ||
| 2009 | + } | ||
| 2010 | + | ||
| 2011 | + xmlFields = Utils::split(buffer, bufferLength, "<", 1); | ||
| 2012 | + for (CDataLen xmlField: xmlFields) { | ||
| 2013 | + if (xmlField.dataLength != 0 && memcmp(xmlField.data, "?", 1) != 0 && (xmlField.data > CommentEnd)) { | ||
| 2014 | + /*Parse XML comments and ignore it.*/ | ||
| 2015 | + if (xmlField.dataLength > 3 && memcmp(xmlField.data, "!--", 3)==0) { | ||
| 2016 | + CommentIndex = 3; | ||
| 2017 | + while (((xmlField.data + CommentIndex) < (buffer + bufferLength)) && memcmp(xmlField.data + CommentIndex, "-->", 3) != 0) { | ||
| 2018 | + CommentIndex++; | ||
| 2019 | + } | ||
| 2020 | + CommentEnd = xmlField.data + CommentIndex; | ||
| 2021 | + continue; | ||
| 2022 | + } else { | ||
| 2023 | + emptyTag = 0; | ||
| 2024 | + /*if the first char is / after < then its ending tag, otherwise starting tag. ("</....") */ | ||
| 2025 | + if (memcmp(xmlField.data, "/", 1) == 0) { | ||
| 2026 | + startTag = 0; | ||
| 2027 | + xmlField.data = xmlField.data + 1; | ||
| 2028 | + xmlField.dataLength -= 1; | ||
| 2029 | + temp2 = Utils::split(xmlField.data, xmlField.dataLength, ">", 1); | ||
| 2030 | + } else { | ||
| 2031 | + | ||
| 2032 | + startTag = 1; | ||
| 2033 | + temp2 = Utils::split(xmlField.data, xmlField.dataLength, ">", 1); | ||
| 2034 | + if (temp2.front().dataLength > 0 && *(char*)(temp2.front().data-1) == '/') { | ||
| 2035 | + //".../>" are empty tags | ||
| 2036 | + emptyTag = 1; | ||
| 2037 | + } | ||
| 2038 | + } | ||
| 2039 | + } | ||
| 2040 | + /*split on ":" to get namespace:tagName*/ | ||
| 2041 | + tagValue = Utils::split(temp2.front().data, temp2.front().dataLength, ":", 1); | ||
| 2042 | + if (tagValue.size() == 1) { | ||
| 2043 | + nsTag = NULL; | ||
| 2044 | + nsLength = 0; | ||
| 2045 | + tagName = tagValue.front().data; | ||
| 2046 | + tagLength = tagValue.front().dataLength; | ||
| 2047 | + } else { | ||
| 2048 | + it = tagValue.begin(); | ||
| 2049 | + nsTag = it->data; | ||
| 2050 | + nsLength = it->dataLength; | ||
| 2051 | + it++; | ||
| 2052 | + tagName = it->data; | ||
| 2053 | + tagLength = it->dataLength; | ||
| 2054 | + } | ||
| 2055 | + tagValue.clear(); | ||
| 2056 | + temp2.clear(); | ||
| 2057 | + | ||
| 2058 | + /*Parse for multiple ns:tags and recompute the first tagLength*/ | ||
| 2059 | + for(i=0; i<tagLength; i++) { | ||
| 2060 | + if ((tagName[i] == ' ')||(tagName[i] == '/')||(tagName[i] == '>')||(tagName[i] == '\t')||(tagName[i] == '\r')||(tagName[i] == '\n')) { | ||
| 2061 | + if (i != 0) { | ||
| 2062 | + if (tagName[i]=='/') { | ||
| 2063 | + emptyTag = 1; | ||
| 2064 | + } | ||
| 2065 | + tagLength = i; | ||
| 2066 | + break; | ||
| 2067 | + } | ||
| 2068 | + } | ||
| 2069 | + } | ||
| 2070 | + | ||
| 2071 | + /*Create XML Node, populate properties and add it to the list*/ | ||
| 2072 | + if (tagLength != 0) { | ||
| 2073 | + newNode = new XMLNode(); | ||
| 2074 | + newNode->tagName = tagName; | ||
| 2075 | + newNode->tagLength = tagLength; | ||
| 2076 | + newNode->startTag = startTag; | ||
| 2077 | + newNode->nsTag = nsTag; | ||
| 2078 | + newNode->nsLength = nsLength; | ||
| 2079 | + | ||
| 2080 | + | ||
| 2081 | + if (rootNode == NULL) { | ||
| 2082 | + rootNode = newNode; | ||
| 2083 | + } | ||
| 2084 | + else { | ||
| 2085 | + current->childNode = newNode; | ||
| 2086 | + } | ||
| 2087 | + current = newNode; | ||
| 2088 | + | ||
| 2089 | + if (emptyTag) { | ||
| 2090 | + newNode = new XMLNode(); | ||
| 2091 | + newNode->tagName = tagName; | ||
| 2092 | + newNode->tagLength = tagLength; | ||
| 2093 | + newNode->nsTag = nsTag; | ||
| 2094 | + newNode->nsLength = nsLength; | ||
| 2095 | + | ||
| 2096 | + current->emptyTag = 1; | ||
| 2097 | + current->childNode = newNode; | ||
| 2098 | + current = newNode; | ||
| 2099 | + } | ||
| 2100 | + } | ||
| 2101 | + | ||
| 2102 | + } | ||
| 2103 | + } | ||
| 2104 | + | ||
| 2105 | + xmlFields.clear(); | ||
| 2106 | + return rootNode; | ||
| 2107 | +} | ||
| 2108 | + | ||
| 2109 | +/* | ||
| 2110 | + * Parse the XML Tree from rootNode and retrive value of a given key. | ||
| 2111 | + * If rootNode is passed as NULL, parsing resumes from last key retrieved node. | ||
| 2112 | + * Return 0 on Success , -1 otherwise. | ||
| 2113 | + * Inputs : XMLNode *rootNode, char *tag, unsigned int tagLen, char *ns, unsigned int nsLen | ||
| 2114 | + * Outputs: char** value, unsigned int *valueLen | ||
| 2115 | + */ | ||
| 2116 | +int MiniXmlParser::getXmlTagValue(XMLNode const* rootNode, char const* tag, unsigned int tagLen, char const* ns, unsigned int nsLen, char** value, unsigned int *valueLen) | ||
| 2117 | +{ | ||
| 2118 | + | ||
| 2119 | + static XMLNode *cur = (XMLNode*) rootNode; | ||
| 2120 | + static XMLNode *pcur = cur; | ||
| 2121 | + char *pValue = NULL; | ||
| 2122 | + bool found = false; | ||
| 2123 | + | ||
| 2124 | + if (tag == NULL) { | ||
| 2125 | + return -1; | ||
| 2126 | + } | ||
| 2127 | + | ||
| 2128 | + if (rootNode != NULL) { | ||
| 2129 | + cur = (XMLNode *) rootNode; | ||
| 2130 | + pcur = cur; | ||
| 2131 | + } | ||
| 2132 | + | ||
| 2133 | + while (cur != NULL) { | ||
| 2134 | + while (pcur != NULL) { | ||
| 2135 | + if (pcur->closingTag && memcmp((pcur->tagName), tag, tagLen) == 0) { | ||
| 2136 | + if (ns) { | ||
| 2137 | + if (memcmp(pcur->nsTag, ns, pcur->nsLength) == 0) { | ||
| 2138 | + found = true; | ||
| 2139 | + } | ||
| 2140 | + } else { | ||
| 2141 | + found = true; | ||
| 2142 | + } | ||
| 2143 | + | ||
| 2144 | + if (found) { | ||
| 2145 | + pValue = strstr(pcur->tagName, ">") + 1; | ||
| 2146 | + if (pcur->closingTag->nsLength) { | ||
| 2147 | + *valueLen = pcur->closingTag->nsTag - pValue - 2; | ||
| 2148 | + } else { | ||
| 2149 | + *valueLen = pcur->closingTag->tagName - pValue - 2; | ||
| 2150 | + } | ||
| 2151 | + *value = pValue; | ||
| 2152 | + pcur = pcur->childNode; | ||
| 2153 | + return 0; | ||
| 2154 | + } | ||
| 2155 | + } | ||
| 2156 | + pcur = pcur->childNode; | ||
| 2157 | + } | ||
| 2158 | + cur = cur->siblingNode; | ||
| 2159 | + pcur = cur; | ||
| 2160 | + } | ||
| 2161 | + | ||
| 2162 | + return -1; | ||
| 2163 | +} | ||
| 2164 | + | ||
| 2165 | +/* Returns Namespace prefix of given URI namespace | ||
| 2166 | + * Inputs : XMLNode *node, char *uri, unsigned int uriLen | ||
| 2167 | + * Outputs: char **nsPrefix, unsigned int *nsPrefixLen | ||
| 2168 | + */ | ||
| 2169 | +int MiniXmlParser::getNSPrefix(XMLNode const* node, char const* uri, unsigned int uriLen, char **nsPrefix, unsigned int *nsPrefixLen) { | ||
| 2170 | + | ||
| 2171 | + bool foundNS = false;; | ||
| 2172 | + char *tagEnd = NULL; | ||
| 2173 | + int rc = 0; | ||
| 2174 | + CDataLen tempNS; | ||
| 2175 | + CDataLen tempURI; | ||
| 2176 | + std::list<CDataLen> tags; | ||
| 2177 | + std::list<CDataLen> temp; | ||
| 2178 | + std::list<CDataLen> temp2; | ||
| 2179 | + std::list<CDataLen>::iterator it; | ||
| 2180 | + | ||
| 2181 | + if (node == NULL || uri == NULL) { | ||
| 2182 | + rc = -1; | ||
| 2183 | + return rc; | ||
| 2184 | + } | ||
| 2185 | + | ||
| 2186 | + tagEnd = strstr(node->tagName, ">"); | ||
| 2187 | + if (tagEnd && nsPrefix != NULL && nsPrefixLen != NULL) { | ||
| 2188 | + tags = Utils::split(node->tagName, tagEnd - node->tagName, " ", 1); | ||
| 2189 | + for (CDataLen tag: tags) { | ||
| 2190 | + temp = Utils::split(tag.data, tag.dataLength, ":", 1); | ||
| 2191 | + if (temp.size() >= 2) { | ||
| 2192 | + it = temp.begin(); | ||
| 2193 | + tempNS.data = it->data; | ||
| 2194 | + tempNS.dataLength = it->dataLength; | ||
| 2195 | + it++; | ||
| 2196 | + | ||
| 2197 | + if (memcmp(tempNS.data, "xmlns", 5) == 0) { | ||
| 2198 | + temp2 = Utils::split(it->data, it->dataLength, "=", 1); | ||
| 2199 | + if (temp2.size() >= 2) { | ||
| 2200 | + it = temp2.begin(); | ||
| 2201 | + tempNS.data = it->data; | ||
| 2202 | + tempNS.dataLength = it->dataLength; | ||
| 2203 | + it++; | ||
| 2204 | + } | ||
| 2205 | + } | ||
| 2206 | + //Ignore if first character is " or ' | ||
| 2207 | + if (it->data[0] == 34 || it->data[0] == 39) { | ||
| 2208 | + it->data = it->data + 1; | ||
| 2209 | + } | ||
| 2210 | + | ||
| 2211 | + if (memcmp(it->data, uri, uriLen) == 0) { | ||
| 2212 | + foundNS = true; | ||
| 2213 | + break; | ||
| 2214 | + } | ||
| 2215 | + } | ||
| 2216 | + } | ||
| 2217 | + } else { | ||
| 2218 | + rc = -1; | ||
| 2219 | + } | ||
| 2220 | + | ||
| 2221 | + if (rc == 0 && foundNS) { | ||
| 2222 | + *nsPrefix = tempNS.data; | ||
| 2223 | + *nsPrefixLen = tempNS.dataLength; | ||
| 2224 | + } | ||
| 2225 | + | ||
| 2226 | + return rc; | ||
| 2227 | +} | ||
| 2228 | diff --git a/src/tools/miniXmlParser.h b/src/tools/miniXmlParser.h | ||
| 2229 | new file mode 100644 | ||
| 2230 | index 0000000..ae0d234 | ||
| 2231 | --- /dev/null | ||
| 2232 | +++ b/src/tools/miniXmlParser.h | ||
| 2233 | @@ -0,0 +1,51 @@ | ||
| 2234 | +/******************************************************************************* | ||
| 2235 | + * Copyright (C) 2017 Intel Corporation. All rights reserved. | ||
| 2236 | + * | ||
| 2237 | + * Redistribution and use in source and binary forms, with or without | ||
| 2238 | + * modification, are permitted provided that the following conditions are met: | ||
| 2239 | + * | ||
| 2240 | + * - Redistributions of source code must retain the above copyright notice, | ||
| 2241 | + * this list of conditions and the following disclaimer. | ||
| 2242 | + * | ||
| 2243 | + * - Redistributions in binary form must reproduce the above copyright notice, | ||
| 2244 | + * this list of conditions and the following disclaimer in the documentation | ||
| 2245 | + * and/or other materials provided with the distribution. | ||
| 2246 | + * | ||
| 2247 | + * - Neither the name of Intel Corporation. nor the names of its | ||
| 2248 | + * contributors may be used to endorse or promote products derived from this | ||
| 2249 | + * software without specific prior written permission. | ||
| 2250 | + * | ||
| 2251 | + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' | ||
| 2252 | + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 2253 | + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 2254 | + * ARE DISCLAIMED. IN NO EVENT SHALL Intel Corporation. OR THE CONTRIBUTORS | ||
| 2255 | + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
| 2256 | + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
| 2257 | + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
| 2258 | + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
| 2259 | + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 2260 | + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
| 2261 | + * POSSIBILITY OF SUCH DAMAGE. | ||
| 2262 | + *******************************************************************************/ | ||
| 2263 | +#ifndef _MINIXMLPARSER_H | ||
| 2264 | +#define _MINIXMLPARSER_H | ||
| 2265 | +#include <iostream> | ||
| 2266 | +#include "xmlNode.h" | ||
| 2267 | + | ||
| 2268 | +class MiniXmlParser { | ||
| 2269 | + public: | ||
| 2270 | + MiniXmlParser(); | ||
| 2271 | + ~MiniXmlParser(); | ||
| 2272 | + int parse(char* buffer, unsigned int bufferLength); | ||
| 2273 | + XMLNode* getRootNode() { return rootNode; }; | ||
| 2274 | + int getXmlTagValue(XMLNode const* rootNode, char const *tag, unsigned int tagLen, char const* ns, unsigned int nsLen, char** value, unsigned int *valueLen); | ||
| 2275 | + int getNSPrefix(XMLNode const* nonde, char const* uri, unsigned int uriLen, char **nsPrefix, unsigned int *nsPrefixLen); | ||
| 2276 | + | ||
| 2277 | + private: | ||
| 2278 | + XMLNode* rootNode; | ||
| 2279 | + XMLNode* _parse(char const* buffer, unsigned int bufferLength); | ||
| 2280 | + /* Validates if the XML is well formed and sets up parent sibling pointers */ | ||
| 2281 | + int validateXML(XMLNode const* rootNode); | ||
| 2282 | + void deleteXmlTree(XMLNode *root); | ||
| 2283 | +}; | ||
| 2284 | +#endif | ||
| 2285 | diff --git a/src/tools/utils.cpp b/src/tools/utils.cpp | ||
| 2286 | new file mode 100644 | ||
| 2287 | index 0000000..ec20b28 | ||
| 2288 | --- /dev/null | ||
| 2289 | +++ b/src/tools/utils.cpp | ||
| 2290 | @@ -0,0 +1,185 @@ | ||
| 2291 | +/******************************************************************************* | ||
| 2292 | + * Copyright (C) 2017 Intel Corporation. All rights reserved. | ||
| 2293 | + * | ||
| 2294 | + * Redistribution and use in source and binary forms, with or without | ||
| 2295 | + * modification, are permitted provided that the following conditions are met: | ||
| 2296 | + * | ||
| 2297 | + * - Redistributions of source code must retain the above copyright notice, | ||
| 2298 | + * this list of conditions and the following disclaimer. | ||
| 2299 | + * | ||
| 2300 | + * - Redistributions in binary form must reproduce the above copyright notice, | ||
| 2301 | + * this list of conditions and the following disclaimer in the documentation | ||
| 2302 | + * and/or other materials provided with the distribution. | ||
| 2303 | + * | ||
| 2304 | + * - Neither the name of Intel Corporation. nor the names of its | ||
| 2305 | + * contributors may be used to endorse or promote products derived from this | ||
| 2306 | + * software without specific prior written permission. | ||
| 2307 | + * | ||
| 2308 | + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' | ||
| 2309 | + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 2310 | + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 2311 | + * ARE DISCLAIMED. IN NO EVENT SHALL Intel Corporation. OR THE CONTRIBUTORS | ||
| 2312 | + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
| 2313 | + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
| 2314 | + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
| 2315 | + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
| 2316 | + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 2317 | + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
| 2318 | + * POSSIBILITY OF SUCH DAMAGE. | ||
| 2319 | + *******************************************************************************/ | ||
| 2320 | +#include <string.h> | ||
| 2321 | +#include "utils.h" | ||
| 2322 | +#include <syslog.h> | ||
| 2323 | +#include <unistd.h> | ||
| 2324 | + | ||
| 2325 | +std::vector<std::string> Utils::split(char const * str, char const * delim) { | ||
| 2326 | + char* tok = (char*)str; | ||
| 2327 | + char* ptok = tok; | ||
| 2328 | + int delimLength = 0; | ||
| 2329 | + std::vector<std::string> splittedStrings; | ||
| 2330 | + | ||
| 2331 | + do { | ||
| 2332 | + if (str == NULL) { | ||
| 2333 | + break; | ||
| 2334 | + } | ||
| 2335 | + | ||
| 2336 | + if (delim == NULL) { | ||
| 2337 | + splittedStrings.push_back(std::string(str)); | ||
| 2338 | + break; | ||
| 2339 | + } | ||
| 2340 | + | ||
| 2341 | + delimLength = strlen(delim); | ||
| 2342 | + tok = strstr(ptok, delim); | ||
| 2343 | + while (tok) { | ||
| 2344 | + if (ptok != tok) { | ||
| 2345 | + splittedStrings.push_back(std::string(ptok, tok-ptok)); | ||
| 2346 | + } | ||
| 2347 | + ptok = tok + delimLength; | ||
| 2348 | + tok = strstr(ptok, delim); | ||
| 2349 | + } | ||
| 2350 | + | ||
| 2351 | + if (ptok != str+strlen(str)) { | ||
| 2352 | + splittedStrings.push_back(std::string(ptok, strlen(ptok))); | ||
| 2353 | + } | ||
| 2354 | + } while(0); | ||
| 2355 | + return splittedStrings; | ||
| 2356 | +} | ||
| 2357 | + | ||
| 2358 | + | ||
| 2359 | +char* Utils::strnstr(char const* haystack, unsigned int haystackLength, char const* needle, unsigned int needleLength) { | ||
| 2360 | + | ||
| 2361 | + char* needleInHaystack = NULL; | ||
| 2362 | + unsigned int j; | ||
| 2363 | + do { | ||
| 2364 | + if (haystack == NULL || needle == NULL) { | ||
| 2365 | + break; | ||
| 2366 | + } | ||
| 2367 | + | ||
| 2368 | + for (unsigned int i = 0; i < haystackLength; i++) { | ||
| 2369 | + if (haystack[i] == '\0' || ((haystackLength - i) < needleLength)) { | ||
| 2370 | + break; | ||
| 2371 | + } | ||
| 2372 | + | ||
| 2373 | + for (j = 0; j < needleLength; j++) { | ||
| 2374 | + if (haystack[i + j] != needle[j]) { | ||
| 2375 | + break; | ||
| 2376 | + } | ||
| 2377 | + } | ||
| 2378 | + | ||
| 2379 | + if (j == needleLength) { | ||
| 2380 | + //Found needle in haystack | ||
| 2381 | + needleInHaystack = (char*)&haystack[i]; | ||
| 2382 | + break; | ||
| 2383 | + } | ||
| 2384 | + } | ||
| 2385 | + } while(0); | ||
| 2386 | + return needleInHaystack; | ||
| 2387 | +} | ||
| 2388 | + | ||
| 2389 | +std::list<CDataLen> Utils::split(char const* str, unsigned int strLength, char const* delim, unsigned int delimLength) { | ||
| 2390 | + char* tok = (char*)str; | ||
| 2391 | + char* ptok = tok; | ||
| 2392 | + std::list<CDataLen> splittedStrings; | ||
| 2393 | + CDataLen dataLen; | ||
| 2394 | + | ||
| 2395 | + do { | ||
| 2396 | + if (str == NULL) { | ||
| 2397 | + break; | ||
| 2398 | + } | ||
| 2399 | + | ||
| 2400 | + if (delim == NULL) { | ||
| 2401 | + dataLen.data = (char*)str; | ||
| 2402 | + dataLen.dataLength = strLength; | ||
| 2403 | + splittedStrings.push_back(dataLen); | ||
| 2404 | + break; | ||
| 2405 | + } | ||
| 2406 | + | ||
| 2407 | + tok = Utils::strnstr(str, strLength, delim, delimLength); | ||
| 2408 | + while (tok) { | ||
| 2409 | + dataLen.data = ptok; | ||
| 2410 | + dataLen.dataLength = tok-ptok; | ||
| 2411 | + if (ptok!=tok) { | ||
| 2412 | + splittedStrings.push_back(dataLen); | ||
| 2413 | + } | ||
| 2414 | + ptok = tok + delimLength; | ||
| 2415 | + tok = Utils::strnstr(ptok, (str + strLength - ptok), delim, delimLength); | ||
| 2416 | + } | ||
| 2417 | + | ||
| 2418 | + if (ptok != (str + strLength)) { | ||
| 2419 | + dataLen.data = ptok; | ||
| 2420 | + dataLen.dataLength = str + strLength - ptok; | ||
| 2421 | + splittedStrings.push_back(dataLen); | ||
| 2422 | + } | ||
| 2423 | + } while (0); | ||
| 2424 | + return splittedStrings; | ||
| 2425 | +} | ||
| 2426 | + | ||
| 2427 | +std::string Utils::DEFAULT_NOTIFY_CMD="export DISPLAY=:0; notify-send -u critical -t 2000 "; | ||
| 2428 | +std::string Utils::NOTIFY_DESKTOP_SCRIPT="/usr/local/bin/notifyDesktop.sh"; | ||
| 2429 | +std::string Utils::NOTIFY_DESKTOP_SCRIPT1="/usr/bin/notifyDesktop.sh"; | ||
| 2430 | + | ||
| 2431 | +void Utils::notifyDesktop(std::string header, std::string body, bool logInSyslog) { | ||
| 2432 | + | ||
| 2433 | + std::string notifyCMD; | ||
| 2434 | + | ||
| 2435 | + if (! access (NOTIFY_DESKTOP_SCRIPT.c_str(), X_OK)) { | ||
| 2436 | + notifyCMD = NOTIFY_DESKTOP_SCRIPT + " '" + header + "' '" + body + "'"; | ||
| 2437 | + } else if (! access (NOTIFY_DESKTOP_SCRIPT1.c_str(), X_OK)) { | ||
| 2438 | + notifyCMD = NOTIFY_DESKTOP_SCRIPT1 + " '" + header + "' '" + body + "'"; | ||
| 2439 | + } else { | ||
| 2440 | + notifyCMD = DEFAULT_NOTIFY_CMD + " '" + header + "' '" + body + "'"; | ||
| 2441 | + } | ||
| 2442 | + | ||
| 2443 | + if (logInSyslog) { | ||
| 2444 | + syslog(LOG_INFO, "%s %s\n", header.c_str(), body.c_str()); | ||
| 2445 | + } | ||
| 2446 | + | ||
| 2447 | + system(notifyCMD.c_str()); | ||
| 2448 | +} | ||
| 2449 | + | ||
| 2450 | + | ||
| 2451 | +std::string Utils::format(const char *format , ...) { | ||
| 2452 | + char* buffer = NULL; | ||
| 2453 | + int bufferLength = 512; | ||
| 2454 | + int _bufferLength = 0; | ||
| 2455 | + va_list vl; | ||
| 2456 | + std::string formattedString(""); | ||
| 2457 | + | ||
| 2458 | + buffer = new char[bufferLength]; | ||
| 2459 | + if (buffer) { | ||
| 2460 | + va_start(vl, format); | ||
| 2461 | + | ||
| 2462 | + _bufferLength = vsnprintf(buffer, bufferLength, format, vl); | ||
| 2463 | + if (bufferLength <= _bufferLength) { | ||
| 2464 | + delete[] buffer; | ||
| 2465 | + buffer = new char[_bufferLength + 1]; | ||
| 2466 | + _bufferLength = vsnprintf(buffer, _bufferLength, format, vl); | ||
| 2467 | + } | ||
| 2468 | + | ||
| 2469 | + formattedString = std::string(buffer); | ||
| 2470 | + va_end(vl); | ||
| 2471 | + delete[] buffer; | ||
| 2472 | + } | ||
| 2473 | + | ||
| 2474 | + return formattedString; | ||
| 2475 | +} | ||
| 2476 | diff --git a/src/tools/utils.h b/src/tools/utils.h | ||
| 2477 | new file mode 100644 | ||
| 2478 | index 0000000..a7568fa | ||
| 2479 | --- /dev/null | ||
| 2480 | +++ b/src/tools/utils.h | ||
| 2481 | @@ -0,0 +1,57 @@ | ||
| 2482 | +/******************************************************************************* | ||
| 2483 | + * Copyright (C) 2017 Intel Corporation. All rights reserved. | ||
| 2484 | + * | ||
| 2485 | + * Redistribution and use in source and binary forms, with or without | ||
| 2486 | + * modification, are permitted provided that the following conditions are met: | ||
| 2487 | + * | ||
| 2488 | + * - Redistributions of source code must retain the above copyright notice, | ||
| 2489 | + * this list of conditions and the following disclaimer. | ||
| 2490 | + * | ||
| 2491 | + * - Redistributions in binary form must reproduce the above copyright notice, | ||
| 2492 | + * this list of conditions and the following disclaimer in the documentation | ||
| 2493 | + * and/or other materials provided with the distribution. | ||
| 2494 | + * | ||
| 2495 | + * - Neither the name of Intel Corporation. nor the names of its | ||
| 2496 | + * contributors may be used to endorse or promote products derived from this | ||
| 2497 | + * software without specific prior written permission. | ||
| 2498 | + * | ||
| 2499 | + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' | ||
| 2500 | + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 2501 | + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 2502 | + * ARE DISCLAIMED. IN NO EVENT SHALL Intel Corporation. OR THE CONTRIBUTORS | ||
| 2503 | + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
| 2504 | + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
| 2505 | + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
| 2506 | + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
| 2507 | + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 2508 | + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
| 2509 | + * POSSIBILITY OF SUCH DAMAGE. | ||
| 2510 | + *******************************************************************************/ | ||
| 2511 | + | ||
| 2512 | +#ifndef __UTILS_H | ||
| 2513 | +#define __UTILS_H | ||
| 2514 | +#include <iostream> | ||
| 2515 | +#include <vector> | ||
| 2516 | +#include <list> | ||
| 2517 | +#include <string> | ||
| 2518 | +#include <cstdarg> | ||
| 2519 | + | ||
| 2520 | +class CDataLen { | ||
| 2521 | + public: | ||
| 2522 | + char* data; | ||
| 2523 | + int dataLength; | ||
| 2524 | + CDataLen() { data = NULL; dataLength = 0; }; | ||
| 2525 | +}; | ||
| 2526 | + | ||
| 2527 | +class Utils { | ||
| 2528 | + public: | ||
| 2529 | + static std::string NOTIFY_DESKTOP_SCRIPT; | ||
| 2530 | + static std::string NOTIFY_DESKTOP_SCRIPT1; | ||
| 2531 | + static std::string DEFAULT_NOTIFY_CMD; | ||
| 2532 | + static std::vector<std::string> split(char const* str, char const * delim); | ||
| 2533 | + static std::list<CDataLen> split(char const* str, unsigned int strLength, char const* delim, unsigned int delimLength); | ||
| 2534 | + static char* strnstr(char const* haystack, unsigned int haystackLength, char const* needle, unsigned int needleLength); | ||
| 2535 | + static void notifyDesktop(std::string header, std::string body, bool logInSyslog); | ||
| 2536 | + static std::string format(const char *format , ...); | ||
| 2537 | +}; | ||
| 2538 | +#endif | ||
| 2539 | diff --git a/src/tools/xmlNode.cpp b/src/tools/xmlNode.cpp | ||
| 2540 | new file mode 100644 | ||
| 2541 | index 0000000..827cd3f | ||
| 2542 | --- /dev/null | ||
| 2543 | +++ b/src/tools/xmlNode.cpp | ||
| 2544 | @@ -0,0 +1,45 @@ | ||
| 2545 | +/******************************************************************************* | ||
| 2546 | + * Copyright (C) 2017 Intel Corporation. All rights reserved. | ||
| 2547 | + * | ||
| 2548 | + * Redistribution and use in source and binary forms, with or without | ||
| 2549 | + * modification, are permitted provided that the following conditions are met: | ||
| 2550 | + * | ||
| 2551 | + * - Redistributions of source code must retain the above copyright notice, | ||
| 2552 | + * this list of conditions and the following disclaimer. | ||
| 2553 | + * | ||
| 2554 | + * - Redistributions in binary form must reproduce the above copyright notice, | ||
| 2555 | + * this list of conditions and the following disclaimer in the documentation | ||
| 2556 | + * and/or other materials provided with the distribution. | ||
| 2557 | + * | ||
| 2558 | + * - Neither the name of Intel Corporation. nor the names of its | ||
| 2559 | + * contributors may be used to endorse or promote products derived from this | ||
| 2560 | + * software without specific prior written permission. | ||
| 2561 | + * | ||
| 2562 | + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' | ||
| 2563 | + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 2564 | + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 2565 | + * ARE DISCLAIMED. IN NO EVENT SHALL Intel Corporation. OR THE CONTRIBUTORS | ||
| 2566 | + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
| 2567 | + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
| 2568 | + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
| 2569 | + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
| 2570 | + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 2571 | + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
| 2572 | + * POSSIBILITY OF SUCH DAMAGE. | ||
| 2573 | + *******************************************************************************/ | ||
| 2574 | +#include "xmlNode.h" | ||
| 2575 | +#include <iostream> | ||
| 2576 | +XMLNode::XMLNode() { | ||
| 2577 | + tagName = NULL; | ||
| 2578 | + nsTag = NULL; | ||
| 2579 | + tagLength = 0; | ||
| 2580 | + nsLength = 0; | ||
| 2581 | + startTag = 0; | ||
| 2582 | + emptyTag = 0; | ||
| 2583 | + | ||
| 2584 | + closingTag = NULL; | ||
| 2585 | + startingTag = NULL; | ||
| 2586 | + parentNode = NULL; | ||
| 2587 | + childNode = NULL; | ||
| 2588 | + siblingNode = NULL; | ||
| 2589 | +} | ||
| 2590 | diff --git a/src/tools/xmlNode.h b/src/tools/xmlNode.h | ||
| 2591 | new file mode 100644 | ||
| 2592 | index 0000000..4a6c91e | ||
| 2593 | --- /dev/null | ||
| 2594 | +++ b/src/tools/xmlNode.h | ||
| 2595 | @@ -0,0 +1,49 @@ | ||
| 2596 | +/******************************************************************************* | ||
| 2597 | + * Copyright (C) 2017 Intel Corporation. All rights reserved. | ||
| 2598 | + * | ||
| 2599 | + * Redistribution and use in source and binary forms, with or without | ||
| 2600 | + * modification, are permitted provided that the following conditions are met: | ||
| 2601 | + * | ||
| 2602 | + * - Redistributions of source code must retain the above copyright notice, | ||
| 2603 | + * this list of conditions and the following disclaimer. | ||
| 2604 | + * | ||
| 2605 | + * - Redistributions in binary form must reproduce the above copyright notice, | ||
| 2606 | + * this list of conditions and the following disclaimer in the documentation | ||
| 2607 | + * and/or other materials provided with the distribution. | ||
| 2608 | + * | ||
| 2609 | + * - Neither the name of Intel Corporation. nor the names of its | ||
| 2610 | + * contributors may be used to endorse or promote products derived from this | ||
| 2611 | + * software without specific prior written permission. | ||
| 2612 | + * | ||
| 2613 | + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' | ||
| 2614 | + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 2615 | + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 2616 | + * ARE DISCLAIMED. IN NO EVENT SHALL Intel Corporation. OR THE CONTRIBUTORS | ||
| 2617 | + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
| 2618 | + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
| 2619 | + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
| 2620 | + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
| 2621 | + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 2622 | + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
| 2623 | + * POSSIBILITY OF SUCH DAMAGE. | ||
| 2624 | + *******************************************************************************/ | ||
| 2625 | +#ifndef __XMLNODE_H | ||
| 2626 | +#define __XMLNODE_H | ||
| 2627 | +class XMLNode { | ||
| 2628 | + | ||
| 2629 | + public: | ||
| 2630 | + char* tagName; | ||
| 2631 | + char* nsTag; | ||
| 2632 | + int tagLength; | ||
| 2633 | + int nsLength; | ||
| 2634 | + int startTag; | ||
| 2635 | + int emptyTag; | ||
| 2636 | + | ||
| 2637 | + XMLNode* closingTag; | ||
| 2638 | + XMLNode* startingTag; | ||
| 2639 | + XMLNode* parentNode; | ||
| 2640 | + XMLNode* childNode; | ||
| 2641 | + XMLNode* siblingNode; | ||
| 2642 | + XMLNode(); | ||
| 2643 | +}; | ||
| 2644 | +#endif | ||
| 2645 | -- | ||
| 2646 | 2.9.3 | ||
| 2647 | |||
diff --git a/common/recipes-bsp/amt/lms7_7.1.20.bb b/common/recipes-bsp/amt/lms7_7.1.20.bb new file mode 100644 index 0000000..eca3681 --- /dev/null +++ b/common/recipes-bsp/amt/lms7_7.1.20.bb | |||
| @@ -0,0 +1,58 @@ | |||
| 1 | DESCRIPTION = "Intel Local Manageability Service allows applications \ | ||
| 2 | to access the Intel Active Management Technology (AMT) firmware via \ | ||
| 3 | the Intel Management Engine Interface (MEI)." | ||
| 4 | HOMEPAGE = "http://software.intel.com/en-us/articles/download-the-latest-intel-amt-open-source-drivers" | ||
| 5 | |||
| 6 | LICENSE = "BSD_LMS" | ||
| 7 | |||
| 8 | PR = "r0" | ||
| 9 | BPN="lms" | ||
| 10 | PV_SUB = "25" | ||
| 11 | SRC_URI = "http://software.intel.com/sites/default/files/m/4/e/a/9/b/37962-${BPN}_${PV}.${PV_SUB}.zip \ | ||
| 12 | file://atnetworktool-printf-fix.patch \ | ||
| 13 | file://readlink-declaration.patch \ | ||
| 14 | file://0001-Protocol.cpp-Add-whitespace-for-gcc6-compile-error.patch \ | ||
| 15 | file://0001-Include-sys-select.h-for-fd_set.patch \ | ||
| 16 | file://0002-Use-proper-netinet-in.h-API.patch \ | ||
| 17 | " | ||
| 18 | |||
| 19 | LOCALSRC = "file://${WORKDIR}/outputdir/${BPN}-${PV}-${PV_SUB}.tar.gz" | ||
| 20 | |||
| 21 | COMPATIBLE_HOST = '(i.86|x86_64).*-linux' | ||
| 22 | |||
| 23 | LIC_FILES_CHKSUM = "file://COPYING;md5=7264184cf88d9f27b719a9656255b47b" | ||
| 24 | |||
| 25 | SRC_URI[md5sum] = "687b76e78bfdbcf567c0e842c1fe240a" | ||
| 26 | SRC_URI[sha256sum] = "cc0457f0044e924794bb1aeae9a72c28666a525cd8a963d0d92970222946e75b" | ||
| 27 | |||
| 28 | inherit autotools update-rc.d | ||
| 29 | |||
| 30 | INITSCRIPT_NAME = "lms7" | ||
| 31 | INITSCRIPT_PARAMS = "defaults" | ||
| 32 | |||
| 33 | python do_unpack() { | ||
| 34 | s = d.getVar('S', True) | ||
| 35 | d.setVar('S', '${WORKDIR}/outputdir') | ||
| 36 | bb.build.exec_func('base_do_unpack', d) | ||
| 37 | # temorarily change SRC_URI for unpack | ||
| 38 | src_uri = d.getVar('SRC_URI', True) | ||
| 39 | d.setVar('SRC_URI', '${LOCALSRC}') | ||
| 40 | d.setVar('S', s) | ||
| 41 | bb.build.exec_func('base_do_unpack', d) | ||
| 42 | d.setVar('SRC_URI', src_uri) | ||
| 43 | } | ||
| 44 | |||
| 45 | |||
| 46 | do_install_append () { | ||
| 47 | mv ${D}/${sbindir}/lms ${D}/${sbindir}/lms7 | ||
| 48 | install -d ${D}${sysconfdir}/init.d | ||
| 49 | # The configure script looks at the host to decide where to put init | ||
| 50 | # scripts, so move it at the same time as renaming it. | ||
| 51 | if test -f ${D}${sysconfdir}/rc.d/init.d/lms ; then | ||
| 52 | mv ${D}${sysconfdir}/rc.d/init.d/lms ${D}${sysconfdir}/init.d/${INITSCRIPT_NAME} | ||
| 53 | else | ||
| 54 | mv ${D}${sysconfdir}/init.d/lms ${D}${sysconfdir}/init.d/${INITSCRIPT_NAME} | ||
| 55 | fi | ||
| 56 | sed -i 's/^NAME=lms/NAME=lms7/' ${D}${sysconfdir}/init.d/${INITSCRIPT_NAME} | ||
| 57 | rmdir ${D}${datadir} || : | ||
| 58 | } | ||
diff --git a/common/recipes-bsp/amt/lms8_8.0.0-7.bb b/common/recipes-bsp/amt/lms8_8.0.0-7.bb new file mode 100644 index 0000000..9b37b9b --- /dev/null +++ b/common/recipes-bsp/amt/lms8_8.0.0-7.bb | |||
| @@ -0,0 +1,46 @@ | |||
| 1 | DESCRIPTION = "Intel Local Manageability Service allows applications \ | ||
| 2 | to access the Intel Active Management Technology (AMT) firmware via \ | ||
| 3 | the Intel Management Engine Interface (MEI)." | ||
| 4 | HOMEPAGE = "http://software.intel.com/en-us/articles/download-the-latest-intel-amt-open-source-drivers" | ||
| 5 | |||
| 6 | LICENSE = "BSD_LMS" | ||
| 7 | |||
| 8 | PR = "r0" | ||
| 9 | BPN="lms" | ||
| 10 | SRC_URI = "http://software.intel.com/sites/default/files/${BPN}-${PV}.tar.gz \ | ||
| 11 | file://readlink-declaration.patch \ | ||
| 12 | file://0001-Protocol.cpp-Add-whitespace-for-gcc6-compile-error.patch \ | ||
| 13 | file://0001-Include-sys-select.h-for-fd_set.patch \ | ||
| 14 | file://0002-Use-proper-netinet-in.h-API.patch \ | ||
| 15 | file://0003-Fix-device-file-referance-to-dev-mei0-remove-select.patch \ | ||
| 16 | file://0004-Intel-AMT-ME-real-time-notification-infra.patch \ | ||
| 17 | " | ||
| 18 | |||
| 19 | FILES_${PN} += "${datadir}/xml/AMTAlerts.xml" | ||
| 20 | |||
| 21 | COMPATIBLE_HOST = '(i.86|x86_64).*-linux' | ||
| 22 | |||
| 23 | LIC_FILES_CHKSUM = "file://COPYING;md5=ec77c894e8a1a89fa07aed2c76680ab8" | ||
| 24 | |||
| 25 | SRC_URI[md5sum] = "3cbd027a0e6e9ced8238478b24cde3c6" | ||
| 26 | SRC_URI[sha256sum] = "7077db6f2f381e67cb37565b20c40ff0c7d3f98f014e65622a4b4b66c2b1d637" | ||
| 27 | |||
| 28 | inherit autotools update-rc.d | ||
| 29 | |||
| 30 | INITSCRIPT_NAME = "lms8" | ||
| 31 | INITSCRIPT_PARAMS = "defaults" | ||
| 32 | |||
| 33 | |||
| 34 | do_install_append () { | ||
| 35 | mv ${D}/${sbindir}/lms ${D}/${sbindir}/lms8 | ||
| 36 | install -d ${D}${sysconfdir}/init.d | ||
| 37 | # The configure script looks at the host to decide where to put init | ||
| 38 | # scripts, so move it at the same time as renaming it. | ||
| 39 | if test -f ${D}${sysconfdir}/rc.d/init.d/lms ; then | ||
| 40 | mv ${D}${sysconfdir}/rc.d/init.d/lms ${D}${sysconfdir}/init.d/${INITSCRIPT_NAME} | ||
| 41 | else | ||
| 42 | mv ${D}${sysconfdir}/init.d/lms ${D}${sysconfdir}/init.d/${INITSCRIPT_NAME} | ||
| 43 | fi | ||
| 44 | sed -i 's/^NAME=lms/NAME=lms8/' ${D}${sysconfdir}/init.d/${INITSCRIPT_NAME} | ||
| 45 | rmdir ${D}${datadir} || : | ||
| 46 | } | ||
