diff --git a/session/stream_session.c b/session/stream_session.c
index fb3dbf2d69d8f672c92e0c64c565c580453deebf..29e2fcb58271760b17dfb63ec6ea6d73c16030ed 100644
--- a/session/stream_session.c
+++ b/session/stream_session.c
@@ -19,7 +19,7 @@
 */
 
 #include <stdlib.h>
-#include "common.h"
+#include "dap_common.h"
 #include "stream_session.h"
 
 #define LOG_TAG "stream_session"
@@ -31,14 +31,14 @@ static void * session_check(void * data);
 
 void stream_session_init()
 {
-    log_it(INFO,"[session] Init module");
+    log_it(L_INFO,"[session] Init module");
     srand ( time(NULL) );
 }
 
 void stream_session_deinit()
 {
     stream_session_t *current, *tmp;
-    log_it(INFO,"[session] Destroy everything");
+    log_it(L_INFO,"[session] Destroy everything");
 
       HASH_ITER(hh, sessions, current, tmp) {
           HASH_DEL(sessions,current);
@@ -60,14 +60,14 @@ stream_session_t * stream_session_pure_new()
         session_id_new=session_id=rand()+rand()*0x100+rand()*0x10000+rand()*0x01000000;
         HASH_FIND_INT(sessions,&session_id_new,ret);
     }while(ret);
-    log_it(INFO,"[session] Creating new with id %u",session_id);
+    log_it(L_INFO,"[session] Creating new with id %u",session_id);
     ret=(stream_session_t*) calloc(1,sizeof(stream_session_t));
     pthread_mutex_init(&ret->mutex, NULL);
     ret->id=session_id;
     ret->time_created=time(NULL);
     ret->create_empty=true;
     ret->enc_type = 0x01; // Default encryption type
-    log_it(DEBUG,"[session] timestamp %u",(unsigned int) ret->time_created);
+    log_it(L_DEBUG,"[session] timestamp %u",(unsigned int) ret->time_created);
     HASH_ADD_INT(sessions,id,ret);
     return ret;
 }
@@ -96,7 +96,7 @@ int stream_session_close(unsigned int id)
 
 int stream_session_close2(stream_session_t * s)
 {
-    log_it(INFO,"[session] Close");
+    log_it(L_INFO,"[session] Close");
     HASH_DEL(sessions,s);
     free(s);
     return 0;
diff --git a/session/stream_session.h b/session/stream_session.h
index 64519d3de735557783e2be3582daa1a5428c0e62..a3213980e0e03e644eb90546d4b8874c79eab865 100644
--- a/session/stream_session.h
+++ b/session/stream_session.h
@@ -27,7 +27,7 @@
 #include <netinet/in.h>
 #include "uthash.h"
 
-#include "enc_key.h"
+#include "dap_enc_key.h"
 
 typedef enum stream_session_type {STREAM_SESSION_TYPE_MEDIA=0,STREAM_SESSION_TYPE_VPN} stream_session_type_t;
 typedef enum stream_session_connection_type {STEAM_SESSION_HTTP = 0, STREAM_SESSION_UDP, STREAM_SESSION_END_TYPE} stream_session_connection_type_t;
diff --git a/stream/stream.c b/stream/stream.c
index 140b74e218b0c5fd4b33ba1ebb48c865551d0440..2c04ed1b8602d49b5a08388eb8e6af84ffbd95d4 100644
--- a/stream/stream.c
+++ b/stream/stream.c
@@ -21,7 +21,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include "config.h"
-#include "common.h"
+#include "dap_common.h"
 
 #include "db_core.h"
 #include "db_auth.h"
@@ -58,7 +58,7 @@ void stream_delete(dap_http_client_t * sh, void * arg);
 int stream_init()
 {
     if( stream_ch_init() != 0 ){
-        log_it(CRITICAL, "Can't init channel types submodule");
+        log_it(L_CRITICAL, "Can't init channel types submodule");
         return -1;
     }
 
@@ -111,23 +111,23 @@ void stream_headers_read(dap_http_client_t * cl_ht, void * arg)
         ai = db_search_cookie_in_db(cl_ht->in_cookie);
 
     if(ai){
-        log_it(DEBUG,"Prepare data stream");
+        log_it(L_DEBUG,"Prepare data stream");
         if(cl_ht->in_query_string[0]){
-            log_it(INFO,"Query string [%s]",cl_ht->in_query_string);
+            log_it(L_INFO,"Query string [%s]",cl_ht->in_query_string);
             if(sscanf(cl_ht->in_query_string,"fj913htmdgaq-d9hf=%u",&id)==1){
                 stream_session_t * ss=NULL;
                 ss=stream_session_id(id);
                 if(ss==NULL){
-                    log_it(ERROR,"No session id %u was found",id);
+                    log_it(L_ERROR,"No session id %u was found",id);
                     cl_ht->reply_status_code=404;
                     strcpy(cl_ht->reply_reason_phrase,"Not found");
                 }else{
-                    log_it(INFO,"Session id %u was found with media_id = %d",id,ss->media_id);
+                    log_it(L_INFO,"Session id %u was found with media_id = %d",id,ss->media_id);
                     if(stream_session_open(ss)==0){ // Create new stream
                         stream_t * sid = stream_new(cl_ht);
                         sid->session=ss;
                         if(ss->create_empty){
-                            log_it(INFO, "Opened stream session with only technical channels");
+                            log_it(L_INFO, "Opened stream session with only technical channels");
 
                             cl_ht->reply_status_code=200;
                             strcpy(cl_ht->reply_reason_phrase,"OK");
@@ -152,17 +152,17 @@ void stream_headers_read(dap_http_client_t * cl_ht, void * arg)
 
                         }
                     }else{
-                        log_it(ERROR,"Can't open session id %u",id);
+                        log_it(L_ERROR,"Can't open session id %u",id);
                         cl_ht->reply_status_code=404;
                         strcpy(cl_ht->reply_reason_phrase,"Not found");
                     }
                 }
             }
         }else{
-            log_it(ERROR,"No query string");
+            log_it(L_ERROR,"No query string");
         }
     }else{
-        log_it(WARNING,"Not authorized connection");
+        log_it(L_WARNING,"Not authorized connection");
         cl_ht->reply_status_code=505;
         strcpy(cl_ht->reply_reason_phrase,"Not authorized");
         cl_ht->state_write=DAP_HTTP_CLIENT_STATE_START;
@@ -227,7 +227,7 @@ void stream_data_write(dap_http_client_t * sh, void * arg)
     if(sh->reply_status_code==200){
         size_t i;
         bool ready_to_write=false;
-      //  log_it(DEBUG,"Process channels data output (%u channels)",STREAM(sh)->channel_count);
+      //  log_it(L_DEBUG,"Process channels data output (%u channels)",STREAM(sh)->channel_count);
 
         for(i=0;i<STREAM(sh)->channel_count; i++){
             stream_ch_t * ch = STREAM(sh)->channel[i];
@@ -236,12 +236,12 @@ void stream_data_write(dap_http_client_t * sh, void * arg)
                 ready_to_write|=ch->ready_to_write;
             }
         }
-        //log_it(DEBUG,"stream_data_out (ready_to_write=%s)", ready_to_write?"true":"false");
+        //log_it(L_DEBUG,"stream_data_out (ready_to_write=%s)", ready_to_write?"true":"false");
 
         dap_client_ready_to_write(sh->client,ready_to_write);
-        //log_it(ERROR,"No stream_data_write_callback is defined");
+        //log_it(L_ERROR,"No stream_data_write_callback is defined");
     }else{
-        log_it(WARNING, "Wrong request, reply status code is %u",sh->reply_status_code);
+        log_it(L_WARNING, "Wrong request, reply status code is %u",sh->reply_status_code);
     }
 }
 
@@ -252,7 +252,7 @@ void stream_data_write(dap_http_client_t * sh, void * arg)
  */
 void stream_proc_pkt_in(stream_t * sid)
 {
-    // log_it(DEBUG,"Input: read last bytes for current packet (hdr.size=%u)",sid->pkt_buf_in-);
+    // log_it(L_DEBUG,"Input: read last bytes for current packet (hdr.size=%u)",sid->pkt_buf_in-);
     stream_ch_pkt_t * ch_pkt= (stream_ch_pkt_t*) calloc(1,sid->pkt_buf_in->hdr.size+sizeof(stream_ch_pkt_hdr_t)+16 );
     stream_pkt_read(sid,sid->pkt_buf_in, ch_pkt);
 
@@ -273,7 +273,7 @@ void stream_proc_pkt_in(stream_t * sid)
                 ch->proc->packet_in_callback(ch,ch_pkt);
 
     }else{
-         log_it(WARNING, "Input: unprocessed channel packet id '%c'",(char) ch_pkt->hdr.id );
+         log_it(L_WARNING, "Input: unprocessed channel packet id '%c'",(char) ch_pkt->hdr.id );
     }
     free(sid->pkt_buf_in);
     sid->pkt_buf_in=NULL;
@@ -294,8 +294,8 @@ void stream_proc_pkt_in(stream_t * sid)
 void stream_data_read(dap_http_client_t * sh, void * arg)
 {
 
-  //  log_it(DEBUG, "Stream data read %u bytes", sh->client->buf_in_size);
-  //  log_it(DEBUG, "Stream data  %s", sh->client->buf_in);
+  //  log_it(L_DEBUG, "Stream data read %u bytes", sh->client->buf_in_size);
+  //  log_it(L_DEBUG, "Stream data  %s", sh->client->buf_in);
     stream_t * sid =STREAM(sh);
     int * ret = (int *) arg;
 
@@ -321,21 +321,21 @@ void stream_data_read(dap_http_client_t * sh, void * arg)
                 *ret = (*ret)+ read_bytes_to;
                 sid->pkt_buf_in_data_size=read_bytes_to-sizeof(stream_pkt_hdr_t);
                 if(read_bytes_to>=(pkt->hdr.size)){
-                    //log_it(INFO,"Input: read full packet (hdr.size=%u read_bytes_to=%u buf_in_size=%u)"
+                    //log_it(L_INFO,"Input: read full packet (hdr.size=%u read_bytes_to=%u buf_in_size=%u)"
                     //       ,sid->pkt_buf_in->hdr.size,read_bytes_to,sid->conn->buf_in_size);
                     stream_proc_pkt_in(sid);
                 }else{
-                    log_it(DEBUG,"Input: Not all stream packet in input (hdr.size=%u read_bytes_to=%u)",sid->pkt_buf_in->hdr.size,read_bytes_to);
+                    log_it(L_DEBUG,"Input: Not all stream packet in input (hdr.size=%u read_bytes_to=%u)",sid->pkt_buf_in->hdr.size,read_bytes_to);
                 }
                 return;
             }else
                 break;
         }
-        //log_it(WARNING,"Input: Not found signature in the incomming data");
+        //log_it(L_WARNING,"Input: Not found signature in the incomming data");
         *ret += sh->client->buf_in_size;
     }
 
-//    log_it(DEBUG,"Stream read data from HTTP client: %u",sh->client->buf_in_size);
+//    log_it(L_DEBUG,"Stream read data from HTTP client: %u",sh->client->buf_in_size);
 //    if(sh->client->buf_in_size )
 }
 
diff --git a/stream/stream_ch.c b/stream/stream_ch.c
index b1ce6fd096713ba930d594bf0553cae29a6f0171..e76a88fc8395296a321e6bd8d3c14d8a24ed4bfa 100644
--- a/stream/stream_ch.c
+++ b/stream/stream_ch.c
@@ -18,7 +18,7 @@
     along with any DAP based project.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#include "common.h"
+#include "dap_common.h"
 
 #include "dap_client.h"
 #include "dap_http_client.h"
@@ -37,11 +37,11 @@
 int stream_ch_init()
 {
     if(stream_ch_proc_init() != 0 ){
-        log_it(CRITICAL,"Can't init stream channel proc submodule");
+        log_it(L_CRITICAL,"Can't init stream channel proc submodule");
         return -1;
     }
     if(stream_ch_pkt_init() != 0 ){
-        log_it(CRITICAL,"Can't init stream channel packet submodule");
+        log_it(L_CRITICAL,"Can't init stream channel packet submodule");
         return -1;
     }
     log_it(NOTICE,"Module stream channel initialized");
@@ -75,7 +75,7 @@ stream_ch_t* stream_ch_new(struct stream* stream,uint8_t id)
             ret->proc->new_callback(ret,NULL);
         return ret;
     }else{
-        log_it(WARNING, "Unknown stream processor with id %uc",id);
+        log_it(L_WARNING, "Unknown stream processor with id %uc",id);
         return NULL;
     }
 }
@@ -103,7 +103,7 @@ void stream_ch_set_ready_to_write(stream_ch_t * ch,bool is_ready)
 {
     pthread_mutex_lock(&ch->mutex);
     if(ch->ready_to_write!=is_ready){
-        //log_it(DEBUG,"Change channel '%c' to %s", (char) ch->proc->id, is_ready?"true":"false");
+        //log_it(L_DEBUG,"Change channel '%c' to %s", (char) ch->proc->id, is_ready?"true":"false");
         ch->ready_to_write=is_ready;
         if(is_ready)
             ch->stream->conn_http->state_write=DAP_HTTP_CLIENT_STATE_DATA;
diff --git a/stream/stream_ch_pkt.c b/stream/stream_ch_pkt.c
index 4f6cd00f965a13717ab1081fc80092b478c6467c..8e661db0ef9cb777fc0b87a95706d1b1912bda01 100644
--- a/stream/stream_ch_pkt.c
+++ b/stream/stream_ch_pkt.c
@@ -21,9 +21,9 @@
 #include <stdio.h>
 #include <stdarg.h>
 
-#include "common.h"
-#include "enc.h"
-#include "enc_key.h"
+#include "dap_common.h"
+#include "dap_enc.h"
+#include "dap_enc_key.h"
 
 #include "dap_client.h"
 #include "stream.h"
@@ -60,7 +60,7 @@ size_t stream_ch_pkt_write_seq_id(struct stream_ch * ch, uint8_t type, uint64_t
 {
     pthread_mutex_lock( &ch->mutex);
 
-    //log_it(DEBUG,"Output: Has %u bytes of %c type for %c channel id",data_size, (char)type, (char) ch->proc->id );
+    //log_it(L_DEBUG,"Output: Has %u bytes of %c type for %c channel id",data_size, (char)type, (char) ch->proc->id );
 
     stream_ch_pkt_hdr_t hdr;
 
@@ -72,7 +72,7 @@ size_t stream_ch_pkt_write_seq_id(struct stream_ch * ch, uint8_t type, uint64_t
     hdr.seq_id=seq_id;
 
     if(data_size+sizeof(hdr)> sizeof(ch->buf) ){
-        log_it(ERROR,"Too big data size %lu, bigger than encryption buffer size %lu",data_size,sizeof(ch->buf));
+        log_it(L_ERROR,"Too big data size %lu, bigger than encryption buffer size %lu",data_size,sizeof(ch->buf));
         data_size=sizeof(ch->buf)-sizeof(hdr);
     }
     memcpy(ch->buf,&hdr,sizeof(hdr) );
diff --git a/stream/stream_ch_proc.c b/stream/stream_ch_proc.c
index b7f443681649f3794f3d3c1bcc3a8942123138aa..1539f44e45b09faa22d1e7f82055fc868c23e90d 100644
--- a/stream/stream_ch_proc.c
+++ b/stream/stream_ch_proc.c
@@ -18,7 +18,7 @@
     along with any DAP based project.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#include "common.h"
+#include "dap_common.h"
 #include "stream_ch_proc.h"
 
 
diff --git a/stream/stream_ctl.c b/stream/stream_ctl.c
index bf075d0b38468bd2b6d0219a1c7068b8df8c7a3d..7a7608aa54ef613299452a153c9d71ef095c44f5 100644
--- a/stream/stream_ctl.c
+++ b/stream/stream_ctl.c
@@ -20,11 +20,11 @@
 
 #include <stdbool.h>
 #include <string.h>
-#include "common.h"
+#include "dap_common.h"
 
 #include "stream.h"
 
-#include "enc_http.h"
+#include "dap_enc_http.h"
 
 #include "dap_http.h"
 #include "dap_http_client.h"
@@ -101,13 +101,13 @@ void stream_ctl_proc(struct dap_http_simple *cl_st, void * arg)
         else if (strcmp(dg->url_path,"socket_forward")==0){
             socket_forward=true;
         }else{
-            log_it(ERROR,"ctl command unknown: %s",dg->url_path);
+            log_it(L_ERROR,"ctl command unknown: %s",dg->url_path);
             enc_http_delegate_delete(dg);
             *isOk=false;
             return;
         }
         if(socket_forward){
-            log_it(INFO,"[ctl] Play request for db_id=%d",db_id);
+            log_it(L_INFO,"[ctl] Play request for db_id=%d",db_id);
             ss=stream_session_pure_new();
 
             char key_str[255];
@@ -117,10 +117,10 @@ void stream_ctl_proc(struct dap_http_simple *cl_st, void * arg)
             ss->key=enc_key_create(key_str,ENC_KEY_TYPE_AES);
             enc_http_reply_f(dg,"%u %s",ss->id,key_str);
             dg->isOk=true;
-       //     log_it(DEBUG,"Stream AES key string %s",key_str);
+       //     log_it(L_DEBUG,"Stream AES key string %s",key_str);
 
         }else if(sscanf( dg->in_query ,"db_id=%u",&db_id)==1){
-            log_it(INFO,"[ctl] Play request for db_id=%d",db_id);
+            log_it(L_INFO,"[ctl] Play request for db_id=%d",db_id);
             ss=stream_session_new(db_id,openPreview);
 
             char key_str[255];
@@ -130,9 +130,9 @@ void stream_ctl_proc(struct dap_http_simple *cl_st, void * arg)
             ss->key=enc_key_create(key_str,ENC_KEY_TYPE_AES);
             enc_http_reply_f(dg,"%u %s",ss->id,key_str);
             dg->isOk=true;
-            log_it(DEBUG,"Stream AES key string %s",key_str);
+            log_it(L_DEBUG,"Stream AES key string %s",key_str);
         }else{
-            log_it(ERROR,"Wrong request: \"%s\"",dg->in_query);
+            log_it(L_ERROR,"Wrong request: \"%s\"",dg->in_query);
             dg->isOk=false;
         }
         *isOk=dg->isOk;
@@ -144,7 +144,7 @@ void stream_ctl_proc(struct dap_http_simple *cl_st, void * arg)
         	sscanf(ct_str, "connection_type=%u", &conn_t);
         	if (conn_t < 0 || conn_t >= STREAM_SESSION_END_TYPE)
         	{
-        		log_it(WARNING,"Error connection type : %i",conn_t);
+        		log_it(L_WARNING,"Error connection type : %i",conn_t);
         		conn_t = STEAM_SESSION_HTTP;
         	}
 
@@ -155,12 +155,12 @@ void stream_ctl_proc(struct dap_http_simple *cl_st, void * arg)
 
         }
 
-        log_it(INFO,"setup connection_type: %s", connection_type_str[conn_t]);
+        log_it(L_INFO,"setup connection_type: %s", connection_type_str[conn_t]);
 
         enc_http_reply_encode(cl_st,dg);
         enc_http_delegate_delete(dg);
     }else{
-        log_it(ERROR,"No encryption layer was initialized well");
+        log_it(L_ERROR,"No encryption layer was initialized well");
         *isOk=false;
     }
 }
diff --git a/stream/stream_pkt.c b/stream/stream_pkt.c
index 01746e0136e7461ee1c2b0b260ac51cc37ecb7be..5bc491bd63ec663ac22897e12ee62b168f17a25b 100644
--- a/stream/stream_pkt.c
+++ b/stream/stream_pkt.c
@@ -20,15 +20,15 @@
 
 #include <stdint.h>
 #include <string.h>
-#include "common.h"
+#include "dap_common.h"
 #include "config.h"
 
 
 #include "dap_client.h"
 #include "dap_http_client.h"
 
-#include "enc.h"
-#include "enc_key.h"
+#include "dap_enc.h"
+#include "dap_enc_key.h"
 
 #include "stream.h"
 #include "stream_pkt.h"
@@ -57,7 +57,7 @@ stream_pkt_t * stream_pkt_detect(void * data, uint32_t data_size)
         if(memcmp(sig_start,dap_sig,sizeof(dap_sig))==0){
             ret=sig_start;
             if(ret->hdr.size > STREAM_PKT_SIZE_MAX ){
-                log_it(ERROR, "Too big packet size %u",ret->hdr.size);
+                log_it(L_ERROR, "Too big packet size %u",ret->hdr.size);
                 ret=NULL;
             }
             break;
@@ -76,11 +76,11 @@ stream_pkt_t * stream_pkt_detect(void * data, uint32_t data_size)
 size_t stream_pkt_read(struct stream * sid,struct stream_pkt * pkt, void * buf_out)
 {
     size_t ds = enc_decode(sid->session->key,pkt->data,pkt->hdr.size,buf_out,ENC_DATA_TYPE_RAW);
-//    log_it(DEBUG,"Stream decoded %lu bytes ( last bytes 0x%02x 0x%02x 0x%02x 0x%02x ) ", ds,
+//    log_it(L_DEBUG,"Stream decoded %lu bytes ( last bytes 0x%02x 0x%02x 0x%02x 0x%02x ) ", ds,
 //           *((uint8_t *)buf_out+ds-4),*((uint8_t *)buf_out+ds-3),*((uint8_t *)buf_out+ds-2),*((uint8_t *)buf_out+ds-1)
 //           );
 //    size_t mv=35;
-//    log_it(DEBUG,"(Decoded  bytes with mv %lu bytes 0x%02x 0x%02x 0x%02x 0x%02x ) ", mv,
+//    log_it(L_DEBUG,"(Decoded  bytes with mv %lu bytes 0x%02x 0x%02x 0x%02x 0x%02x ) ", mv,
 //           *((uint8_t *)buf_out+mv-4),*((uint8_t *)buf_out+mv-3),*((uint8_t *)buf_out+mv-2),*((uint8_t *)buf_out+mv-1)
 //           );
     return ds;
@@ -100,7 +100,7 @@ size_t stream_pkt_write(struct stream * sid, const void * data, uint32_t data_si
     stream_pkt_hdr_t pkt_hdr;
 
     if(data_size> sizeof(sid->buf) ){
-        log_it(ERROR,"Too big data size %lu, bigger than encryption buffer size %lu",data_size,sizeof(sid->buf));
+        log_it(L_ERROR,"Too big data size %lu, bigger than encryption buffer size %lu",data_size,sizeof(sid->buf));
         data_size=sizeof(sid->buf);
     }