Skip to content
Snippets Groups Projects
Unverified Commit 7194c7a9 authored by Dmitriy A. Gerasimov's avatar Dmitriy A. Gerasimov Committed by GitHub
Browse files

Merge pull request #2 from IvanDeniskin/master

Build errors
parents 7827df11 386c5275
No related branches found
No related tags found
1 merge request!24Support 3689
......@@ -7,20 +7,18 @@ include_directories("${INCLUDE_DIRECTORIES} ${dap_core_INCLUDE_DIRS}")
include_directories("${INCLUDE_DIRECTORIES} ${dap_core_server_INCLUDE_DIRS}")
include_directories("${INCLUDE_DIRECTORIES} ${dap_crypto_INCLUDE_DIRS}")
include_directories("${INCLUDE_DIRECTORIES} ${dap_client_INCLUDE_DIRS}")
include_directories("${INCLUDE_DIRECTORIES} ${dap_auth_INCLUDE_DIRS}")
include_directories("${INCLUDE_DIRECTORIES} ${dap_session_INCLUDE_DIRS}")
include_directories("${INCLUDE_DIRECTORIES} ${dap_db_INCLUDE_DIRS}")
include_directories("${INCLUDE_DIRECTORIES} ${dap_http_INCLUDE_DIRS}")
include_directories("${INCLUDE_DIRECTORIES} ${dap_http_server_INCLUDE_DIRS}")
include_directories("${INCLUDE_DIRECTORIES} ${dap_enc_server_INCLUDE_DIRS}")
include_directories("${INCLUDE_DIRECTORIES} ${MONGO_INCLUDE_DIRS}")
add_definitions ("${dap_core_DEFINITIONS}")
add_definitions ("${dap_core_server_DEFINITIONS}")
add_definitions ("${dap_crypto_DEFINITIONS}")
add_definitions ("${dap_client_DEFINITIONS}")
add_definitions ("${dap_auth_DEFINITIONS}")
add_definitions ("${dap_db_DEFINITIONS}")
add_definitions ("${dap_http_server_DEFINITIONS}")
add_definitions ("${dap_enc_server_DEFINITIONS}")
add_definitions ("${dap_http_DEFINITIONS}")
add_definitions ("${dap_session_DEFINITIONS}")
......
......@@ -102,68 +102,55 @@ void stream_headers_read(dap_http_client_t * cl_ht, void * arg)
// int raw_size;
unsigned int id=0;
db_auth_info_t * ai = db_auth_info_by_cookie(cl_ht->in_cookie);
if (ai == NULL)
ai = db_search_cookie_in_db(cl_ht->in_cookie);
if(ai){
log_it(L_DEBUG,"Prepare data stream");
if(cl_ht->in_query_string[0]){
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(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(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(L_INFO, "Opened stream session with only technical channels");
cl_ht->reply_status_code=200;
strcpy(cl_ht->reply_reason_phrase,"OK");
//cl_ht->state_write=DAP_HTTP_CLIENT_STATE_START;
//cl_ht->client->ready_to_write=true;
cl_ht->state_read=DAP_HTTP_CLIENT_STATE_DATA;
cl_ht->out_content_ready=true;
stream_ch_new(sid,'s');
stream_ch_new(sid,'t');
stream_states_update(sid);
dap_client_ready_to_read(cl_ht->client,true);
}else{
stream_ch_new(sid,'s');
stream_ch_new(sid,'g');
cl_ht->reply_status_code=200;
strcpy(cl_ht->reply_reason_phrase,"OK");
cl_ht->state_read=DAP_HTTP_CLIENT_STATE_DATA;
dap_client_ready_to_read(cl_ht->client,true);
stream_states_update(sid);
}
log_it(L_DEBUG,"Prepare data stream");
if(cl_ht->in_query_string[0]){
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(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(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(L_INFO, "Opened stream session with only technical channels");
cl_ht->reply_status_code=200;
strcpy(cl_ht->reply_reason_phrase,"OK");
//cl_ht->state_write=DAP_HTTP_CLIENT_STATE_START;
//cl_ht->client->ready_to_write=true;
cl_ht->state_read=DAP_HTTP_CLIENT_STATE_DATA;
cl_ht->out_content_ready=true;
stream_ch_new(sid,'s');
stream_ch_new(sid,'t');
stream_states_update(sid);
dap_client_ready_to_read(cl_ht->client,true);
}else{
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");
stream_ch_new(sid,'s');
stream_ch_new(sid,'g');
cl_ht->reply_status_code=200;
strcpy(cl_ht->reply_reason_phrase,"OK");
cl_ht->state_read=DAP_HTTP_CLIENT_STATE_DATA;
dap_client_ready_to_read(cl_ht->client,true);
stream_states_update(sid);
}
}else{
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(L_ERROR,"No query string");
}
}else{
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;
dap_client_ready_to_write(cl_ht->client,true);
log_it(L_ERROR,"No query string");
}
}
......@@ -179,7 +166,7 @@ stream_t * stream_new(dap_http_client_t * sh)
ret->conn_http=sh;
sh->internal=ret;
sh->_internal=ret;
log_it(L_NOTICE,"New stream instance");
return ret;
......
......@@ -33,7 +33,7 @@
#define CHUNK_SIZE_MAX 3*1024
struct dap_client;
struct dap_client_remote;
struct dap_http_client;
struct dap_http;
......@@ -47,7 +47,7 @@ typedef struct stream {
int id;
stream_session_t * session;
struct dap_client * conn; // Connection
struct dap_client_remote * conn; // Connection
struct dap_http_client * conn_http; // HTTP-specific
......@@ -68,7 +68,7 @@ typedef struct stream {
} stream_t;
#define STREAM(a) ((stream_t *) (a)->internal )
#define STREAM(a) ((stream_t *) (a)->_internal )
extern int stream_init();
extern void stream_deinit();
......
......@@ -52,7 +52,7 @@ void stream_ctl_proc(struct dap_http_simple *cl_st, void * arg);
*/
int stream_ctl_init()
{
log_it(NOTICE,"Initialized stream control module");
log_it(L_NOTICE,"Initialized stream control module");
return 0;
}
......@@ -114,7 +114,7 @@ void stream_ctl_proc(struct dap_http_simple *cl_st, void * arg)
for(int i = 0; i < sizeof(key_str); i++)
key_str[i] = 65 + rand() % 25;
ss->key=enc_key_create(key_str,ENC_KEY_TYPE_AES);
ss->key=enc_key_create(key_str,DAP_ENC_KEY_TYPE_AES);
enc_http_reply_f(dg,"%u %s",ss->id,key_str);
dg->isOk=true;
// log_it(L_DEBUG,"Stream AES key string %s",key_str);
......@@ -127,7 +127,7 @@ void stream_ctl_proc(struct dap_http_simple *cl_st, void * arg)
for(int i = 0; i < sizeof(key_str); i++)
key_str[i] = 65 + rand() % 25;
ss->key=enc_key_create(key_str,ENC_KEY_TYPE_AES);
ss->key=enc_key_create(key_str,DAP_ENC_KEY_TYPE_AES);
enc_http_reply_f(dg,"%u %s",ss->id,key_str);
dg->isOk=true;
log_it(L_DEBUG,"Stream AES key string %s",key_str);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment