Monthly Archives: November 2017

C++ String Concatenation

Reference

std::stringbuf::str
std::stringstream::stringstream

Good

stackoverflow

C++ equivalent of StringBuffer/StringBuilder?
Please help me to understand the difference between streambuf, stringbuf and stringstream?
What exactly does stringstream do?
How to implement StringBuilder class which to be able to accept IO manipulators

Wikipedia

C++ string handling
Resource acquisition is initialization (RAII)
Automatic variable

ESP32.com

How to use strings in esp idf?
Using C++ std::stringstream and heap exceptions

Bad

A C++ StringBuilder Class, 14.09.2007
4350% Performance Improvement with the StringBuilder for C++!, 10.09.2013

qmail-qfilter: Filtern bevor es in die Queue kommt

$ cat /usr/local/vpopmail/etc/tcp.smtp
127.:allow,RELAYCLIENT=""
:allow,QMAILQUEUE="/var/qmail/bin/qmail-localfilter.sh",GREYLIST="Y"

$ cat /var/qmail/bin/qmail-localfilter.sh
#!/bin/sh
exec /usr/local/bin/qmail-qfilter ${SPAMC_BIN}/spamc ${SPAMC_FLAGS} -- ${QMAIL_LOCALFILTER_BIN}/qmail-localfilter.pl ${QMAIL_LOCALFILTER_FLAGS}

$ file /usr/local/bin/qmail-qfilter
/usr/local/bin/qmail-qfilter: ELF 64-bit LSB executable, x86-64, version 1 (OS), dynamically linked, interpreter /libexec/ld-elf.so.1, for OS x.y stripped

$ file /var/qmail/bin/qmail-localfilter.pl
/var/qmail/bin/qmail-localfilter.pl: a /usr/local/bin/perl script, ASCII text executable

qmail-qfilter, qmail-queue multi-filter front end
Installing qmail-qfilter


# [...]

$log_facility = "mail";
if($opt_s)
{
    $log_facility = $opt_s;
}

# [...]

# Begin by processing the mail header...
while(<>) {

  # [...]

  # Check for an "X-Spam-Flag: YES" line
  # If we find one, this piece of crap is busted.
  if (/^X-Spam-Flag: YES/oi) {
    $spam = 1;
    $opt_d and warn "DEBUG: Mail is spam!\n";
  }

  # [...]
}

#
# If this is spam, log that we have rejected it, (with the
# "from" and "to" lines if possible), include the reason why it
# was rejected, (if we have it), and exit with status code 31.
#
if ($spam) {
  setlogsock('unix');
  openlog('qmail-localfilter.pl','0',$log_facility);
  if ($have_from) {
    syslog('info',"Rejected spam $from $to");
  } else {
    if ($have_to) {
      syslog('info',"Rejected spam $to");
    } else {
    syslog('info',"Rejected spam.");
    }
  }
  if ($have_reason) {
    syslog('info',"$reason");
  }
  exit 31
}

# [...]

Arduino / ESP32 Logging

.platformio/packages/framework-arduinoespressif32/cores/esp32
esp32-hal-log.h:int log_printf(const char *fmt, ...);
esp32-hal-log.h:#define log_v(format, ...) log_printf(ARDUHAL_LOG_FORMAT(V, format), ##__VA_ARGS__)
esp32-hal-log.h:#define log_d(format, ...) log_printf(ARDUHAL_LOG_FORMAT(D, format), ##__VA_ARGS__)
esp32-hal-log.h:#define log_i(format, ...) log_printf(ARDUHAL_LOG_FORMAT(I, format), ##__VA_ARGS__)
esp32-hal-log.h:#define log_w(format, ...) log_printf(ARDUHAL_LOG_FORMAT(W, format), ##__VA_ARGS__)
esp32-hal-log.h:#define log_e(format, ...) log_printf(ARDUHAL_LOG_FORMAT(E, format), ##__VA_ARGS__)
esp32-hal-uart.c:int log_printf(const char *format, ...)
.platformio/packages/framework-arduinoespressif32/tools/sdk/include/config
--- sdkconfig.h.orig    2017-11-13 14:51:26.776375400 +0100
+++ sdkconfig.h 2017-11-13 14:52:09.400429500 +0100
@@ -58,7 +58,7 @@
 #define CONFIG_NUMBER_OF_UNIVERSAL_MAC_ADDRESS 4
 #define CONFIG_ESPTOOLPY_FLASHSIZE_DETECT 1
 #define CONFIG_AUTOSTART_ARDUINO 1
-#define CONFIG_LOG_DEFAULT_LEVEL_ERROR 1
+#define CONFIG_LOG_DEFAULT_LEVEL_VERBOSE 1
 #define CONFIG_ESP32_ENABLE_COREDUMP_TO_NONE 1
 #define CONFIG_BTDM_CONTROLLER_RUN_CPU 0
 #define CONFIG_TCPIP_TASK_STACK_SIZE 2560
@@ -71,7 +71,7 @@
 #define CONFIG_BTC_TASK_STACK_SIZE 8192
 #define CONFIG_BLUEDROID_ENABLED 1
 #define CONFIG_ESPTOOLPY_BEFORE "default_reset"
-#define CONFIG_LOG_DEFAULT_LEVEL 1
+#define CONFIG_LOG_DEFAULT_LEVEL 5
 #define CONFIG_TIMER_QUEUE_LENGTH 10
 #define CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM 0
 #define CONFIG_ESP32_PHY_MAX_WIFI_TX_POWER 20
@@ -103,12 +103,12 @@
 #define CONFIG_BROWNOUT_DET 1
 #define CONFIG_ESP32_XTAL_FREQ 0
 #define CONFIG_MONITOR_BAUD_115200B 1
-#define CONFIG_LOG_BOOTLOADER_LEVEL 0
+#define CONFIG_LOG_BOOTLOADER_LEVEL 5
 #define CONFIG_SMP_ENABLE 1
 #define CONFIG_ESPTOOLPY_BEFORE_RESET 1
 #define CONFIG_ESPTOOLPY_BAUD_OTHER_VAL 115200
 #define CONFIG_ENABLE_ARDUINO_DEPENDS 1
-#define CONFIG_LOG_BOOTLOADER_LEVEL_NONE 1
+#define CONFIG_LOG_BOOTLOADER_LEVEL_VERBOSE 1
 #define CONFIG_ESP32_DEFAULT_CPU_FREQ_240 1
 #define CONFIG_ESP32_XTAL_FREQ_AUTO 1
 #define CONFIG_TCP_MAXRTX 12

Honor the ESP_LOGx logging macros
Commit: Implement ESP_LOGx override option

An Arduino library for logging to Syslog server in IETF format (RFC 5424) and BSD format (RFC 3164)
Hardware: ESP8266 / ESP32 / Arduino Ethernet / etc.
github.com/arcao/Syslog

Logging library for Arduino, by LunaX – 2010/2011

ESP32 nkolban

Initial commit: 06.09.2017, current HEAD: 25.10.2017
github.com/espressif/esp-idf/components/pthread/pthread.c (History)

Initial commit: 15.11.2016, current HEAD: 12.09.2017
github.com/espressif/esp-idf/components/bt/bluedroid/api/include/esp_gatt_defs.h (History)

Commit: cxx: Add KConfig option for C++ exceptions, disable by default

Add missing support for C++ exceptions #681
[TW#12147] Unable to switch on C++ exception handling -fexceptions #459
IROM_ALIGN AssertionError when using fexceptions #188 (duplicate)

github nkolban

HttpServer.cpp compilation error

github cmmakerclub

github.com/cmmakerclub/esp32-webserver/

PlatformIO

ESP32 BLE Arduino by Neil Kolban
github.com/platformio/platform-espressif32/issues

ESP-IDF:
/c/Users/bachman0/.platformio/packages/framework-espidf/components/esp32/ld/esp32.common.ld

Arduino:
/c/Users/bachman0/.platformio/packages/framework-arduinoespressif32/tools/sdk/ld/esp32.common.ld

$ grep -r tcpip_adapter_init .
./libraries/WiFi/src/WiFiGeneric.cpp:        tcpip_adapter_init();
./tools/sdk/include/tcpip_adapter/tcpip_adapter.h: * tcpip_adapter_init should be called in the start of app_main for only once.
./tools/sdk/include/tcpip_adapter/tcpip_adapter.h:void tcpip_adapter_init(void);
Übereinstimmungen in Binärdatei ./tools/sdk/lib/libtcpip_adapter.a