From 9766e41dee5539a35028c20bc89132eb000d7c53 Mon Sep 17 00:00:00 2001 From: Noah Laptop Date: Mon, 5 Aug 2019 20:35:32 -0700 Subject: [PATCH] fix build compatibility issues, add travis build test --- .travis.yml | 22 ++++++++++++++++++++++ src/SSLClient.h | 30 +++++------------------------- src/SSLClientImpl.h | 1 - src/config.h | 2 ++ 4 files changed, 29 insertions(+), 26 deletions(-) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..8537ce1 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,22 @@ +language: c +sudo: false +cache: + directories: + - ~/arduino_ide + - ~/.arduino15/packages/ +git: + depth: false + quiet: true +env: + global: + # You can uncomment this to explicitly choose an (old) version of the Arduino IDE + #- ARDUINO_IDE_VERSION="1.8.7" + - INSTALL_PLATFORMS=samd +before_install: + - source <(curl -SLs https://raw.githubusercontent.com/adafruit/travis-ci-arduino/master/install.sh) +install: + # Note that every library should be installed in a seperate command + - if [! -d "$HOME/arduino_ide/libraries/EthernetLarge" ]; then git clone https://github.com/OPEnSLab-OSU/EthernetLarge.git $HOME/arduino_ide/libraries/EthernetLarge; fi + +script: + - build_platform zero \ No newline at end of file diff --git a/src/SSLClient.h b/src/SSLClient.h index 0c078e1..215a2b3 100644 --- a/src/SSLClient.h +++ b/src/SSLClient.h @@ -18,7 +18,6 @@ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include #include "Client.h" #include "SSLClientImpl.h" #include "SSLSession.h" @@ -48,7 +47,6 @@ class SSLClient : public SSLClientImpl { * amount past that will require special modification of this library, and * assumes you know what you are doing. */ -static_assert(std::is_base_of::value, "SSLClient can only accept a type with base class Client!"); static_assert(SessionCache > 0 && SessionCache < 255, "There can be no less than one and no more than 255 sessions in the cache!"); static_assert(SessionCache <= 3, "You need to decrease the size of m_iobuf in order to have more than 3 sessions at once, otherwise memory issues will occur."); @@ -356,30 +354,12 @@ public: bool operator==(const C& rhs) { return m_client == rhs; } /** @brief Returns whether or not two SSLClient objects do not have the same underlying client object */ bool operator!=(const C& rhs) { return m_client != rhs; } - /** @brief Returns the local port, C::localPort exists. Else return 0. */ - uint16_t localPort() override { - if (std::is_member_function_pointer::value) return m_client.localPort(); - else { - m_warn("Client class has no localPort function, so localPort() will always return 0", __func__); - return 0; - } - } - /** @brief Returns the remote IP, if C::remoteIP exists. Else return INADDR_NONE. */ - IPAddress remoteIP() override { - if (std::is_member_function_pointer::value) return m_client.remoteIP(); - else { - m_warn("Client class has no remoteIP function, so remoteIP() will always return INADDR_NONE. This means that sessions caching will always be disabled.", __func__); - return INADDR_NONE; - } - } + /** @brief Returns the local port, if C::localPort exists */ + uint16_t localPort() override { return m_client.localPort(); } + /** @brief Returns the remote IP, if C::remoteIP exists. */ + IPAddress remoteIP() override { return m_client.remoteIP(); } /** @brief Returns the remote port, if C::remotePort exists. Else return 0. */ - uint16_t remotePort() override { - if (std::is_member_function_pointer::value) return m_client.remotePort(); - else { - m_warn("Client class has no remotePort function, so remotePort() will always return 0", __func__); - return 0; - } - } + uint16_t remotePort() override { return m_client.remotePort(); } /** @brief Returns a reference to the client object stored in this class. Take care not to break it. */ C& getClient() { return m_client; } diff --git a/src/SSLClientImpl.h b/src/SSLClientImpl.h index 7b6cd2c..01af2f1 100644 --- a/src/SSLClientImpl.h +++ b/src/SSLClientImpl.h @@ -203,7 +203,6 @@ private: * connection. */ unsigned char m_iobuf[2048]; - static_assert(sizeof m_iobuf <= BR_SSL_BUFSIZE_BIDI, "m_iobuf must be below maximum buffer size"); // store the index of where we are writing in the buffer // so we can send our records all at once to prevent // weird timing issues diff --git a/src/config.h b/src/config.h index 001b352..ad4969f 100644 --- a/src/config.h +++ b/src/config.h @@ -159,7 +159,9 @@ * Note: if BR_LOMUL is not explicitly enabled or disabled, then * enabling BR_ARMEL_CORTEXM_GCC also enables BR_LOMUL. */ +#ifdef ARDUINO_ARCH_SAMD #define BR_ARMEL_CORTEXM_GCC 1 +#endif /* * When BR_AES_X86NI is enabled, the AES implementation using the x86 "NI"