Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
cellframe-sdk
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Code
Merge requests
16
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cellframe
cellframe-sdk
Commits
7194c7a9
Unverified
Commit
7194c7a9
authored
6 years ago
by
Dmitriy A. Gerasimov
Committed by
GitHub
6 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #2 from IvanDeniskin/master
Build errors
parents
7827df11
386c5275
No related branches found
No related tags found
1 merge request
!24
Support 3689
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
stream/CMakeLists.txt
+2
-4
2 additions, 4 deletions
stream/CMakeLists.txt
stream/stream.c
+44
-57
44 additions, 57 deletions
stream/stream.c
stream/stream.h
+3
-3
3 additions, 3 deletions
stream/stream.h
stream/stream_ctl.c
+3
-3
3 additions, 3 deletions
stream/stream_ctl.c
with
52 additions
and
67 deletions
stream/CMakeLists.txt
+
2
−
4
View file @
7194c7a9
...
...
@@ -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
}
"
)
...
...
This diff is collapsed.
Click to expand it.
stream/stream.c
+
44
−
57
View file @
7194c7a9
...
...
@@ -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
;
...
...
This diff is collapsed.
Click to expand it.
stream/stream.h
+
3
−
3
View file @
7194c7a9
...
...
@@ -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
();
...
...
This diff is collapsed.
Click to expand it.
stream/stream_ctl.c
+
3
−
3
View file @
7194c7a9
...
...
@@ -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
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment