#13795: Initial commit for sflphone-android

includes: libexpat libyaml libdbus-c++ commoncpp ccrtp
          libdbus (from android-4.0.4 sources)

TODO:
- git ignores "/jni/sflphone", sflphone repo should be cloned.
- sflphone-android only needs daemon directory. Ideally it should be possible
to clone it without cloning the whole sflphone project.
into sfl-android (commit 6a0fa7a "#13961: Fix cipher handling" has been used here)
- add pjsip-android project as a git submodule
- sflphone-android needs pjsip android project. Ideally daemon git repository
should not embed pjsip. Instead pjsip should be clone from official repositories.

Considering this, structure should have three distincts git repos:

sflphone-android/.git
sflphone-android/jni/ccrtp-1.8.0-android
sflphone-android/jni/commoncpp2-1.8.1-android
sflphone-android/jni/dbus
sflphone-android/jni/libdbus-c++-0.9.0-android
sflphone-android/jni/libexpat
sflphone-android/jni/libyaml

sflphone-android/jni/sflphone-daemon/.git
sflphone-android/jni/sflphone-daemon/src/audio
sflphone-android/jni/sflphone-daemon/src/config
sflphone-android/jni/sflphone-daemon/src/dbus
sflphone-android/jni/sflphone-daemon/src/history
sflphone-android/jni/sflphone-daemon/src/hooks
sflphone-android/jni/sflphone-daemon/src/iax
sflphone-android/jni/sflphone-daemon/src/sip
sflphone-android/jni/sflphone-daemon/src/video

sflphone-android/jni/pjsip-android/.git

Signed-off-by: Emeric Vigier <emeric.vigier@savoirfairelinux.com>
diff --git a/jni/commoncpp2-1.8.1-android/tests/url1.cpp b/jni/commoncpp2-1.8.1-android/tests/url1.cpp
new file mode 100644
index 0000000..b460f89
--- /dev/null
+++ b/jni/commoncpp2-1.8.1-android/tests/url1.cpp
@@ -0,0 +1,99 @@
+#include <cc++/common.h>
+
+// This was a test base64 stuff
+
+#ifdef	CCXX_NAMESPACES
+using namespace std;
+using namespace ost;
+#endif
+
+#define BUFLEN 512
+char buf1[BUFLEN];
+char buf2[BUFLEN];
+
+bool errorOccurred = false;
+char status[256] = "";
+
+void printBug(const char*msg)
+{
+	errorOccurred = true;
+	printf("status = %s\n%s!\n",status,msg);
+}
+
+const char fillChar='&';
+
+void initBuf(char* buf)
+{
+	memset(buf,fillChar,BUFLEN);
+}
+
+void checkBuf(char* buf,int prev,int size)
+{
+	int i;
+	for(i=0;i<prev;++i)
+		if (buf[i] != fillChar) {
+			printBug("buffer overflow founded");
+			return;
+		}
+	for(i=prev+size;i<BUFLEN;++i)
+		if (buf[i] != fillChar) {
+			printBug("buffer overflow founded");
+			return;
+		}
+}
+
+// check with binary functions
+void check1(unsigned char* s,size_t len,size_t buflen1,size_t buflen2,bool checkEqual=false)
+{
+	initBuf(buf1);
+	b64Encode(s,len,buf1+16,buflen1);
+	checkBuf(buf1,16,buflen1);
+	initBuf(buf2);
+	b64Decode(buf1+16,(unsigned char*)buf2+16,buflen2);
+	checkBuf(buf2,16,buflen2);
+	if (checkEqual && memcmp(s,buf2+16,len) != 0)
+		printBug ("buffer different");
+}
+
+// check with old string
+void check2(const char* s,size_t buflen,bool checkEqual=false)
+{
+	if (!buflen) return;
+	initBuf(buf1);
+	b64Encode(s,buf1+16,buflen);
+	checkBuf(buf1,16,buflen);
+	initBuf(buf2);
+	size_t buflen2 = strlen(buf1+16)+1;
+	b64Decode(buf1+16,buf2+16);
+	checkBuf(buf2,16,buflen2);
+	if (checkEqual && strcmp(s,buf2+16) != 0) {
+		printBug ("buffer different");
+		printf("'%s' != '%s'\n'%s'\n",s,buf2+16,buf1+16);
+	}
+}
+
+// check buffer overflow on string
+void checkStringOverflow(char* s,unsigned int len)
+{
+	bool execCheck2 = (strlen(s) == len);
+	for(unsigned int l1=0;l1<32;++l1) {
+		sprintf(status,"%s %d",s,l1);
+		if (execCheck2)
+			check2(s,l1,l1 >= (len+2)/3*4+1);
+		for(unsigned int l2=0;l2<32;++l2)
+			check1((unsigned char*)s,len,l1,l2,
+					(l1 >= (len+2)/3*4+1)
+					&& (l2 >= len) );
+	}
+}
+
+int main()
+{
+	checkStringOverflow((char *)"",0);
+	checkStringOverflow((char *)"aaa",3);
+	if (!errorOccurred)
+		printf("All seem ok\n");
+	return 0;
+}
+
+