Skip to content
Snippets Groups Projects
Commit 84a740dd authored by Aleksandr Lysikov's avatar Aleksandr Lysikov Committed by Kurotych Anatolii
Browse files

Feature 2198 (#4)

Fix stream interaction
parent d33fdc54
No related branches found
No related tags found
No related merge requests found
......@@ -50,3 +50,6 @@ modules.order
Module.symvers
Mkfile.old
dkms.conf
/build/
/.cproject
/.project
......@@ -16,3 +16,9 @@
[submodule "test/libdap-test"]
path = test/libdap-test
url = https://github.com/kelvinblockchain/libdap-test
[submodule "libdap-stream-ch-chain"]
path = libdap-stream-ch-chain
url = https://github.com/kelvinblockchain//libdap-stream-ch-chain
[submodule "libdap-server-udp"]
path = libdap-server-udp
url = https://github.com/kelvinblockchain/libdap-server-udp
......@@ -2,11 +2,12 @@ cmake_minimum_required(VERSION 3.0)
project (dap_client)
set(CMAKE_C_STANDARD 11)
if(NOT (${SUBMODULES_NO_BUILD} MATCHES ON))
set(SUBMODULES_NO_BUILD ON)
add_subdirectory(libdap)
add_subdirectory(libdap-server-core)
add_subdirectory(libdap-server)
add_subdirectory(libdap-server-udp)
add_subdirectory(libdap-stream)
add_subdirectory(libdap-stream-ch)
......@@ -20,7 +21,7 @@ file(GLOB DAP_CLIENT_HEADERS *.h)
add_library(${PROJECT_NAME} STATIC ${DAP_CLIENT_SRCS} ${DAP_CLIENT_HEADERS})
target_link_libraries(${PROJECT_NAME} dap_crypto dap_core dap_http_server dap_session dap_stream curl)
target_link_libraries(${PROJECT_NAME} dap_crypto dap_core dap_http_server dap_session dap_stream dap_stream_ch curl)
target_include_directories(${PROJECT_NAME} INTERFACE .)
......@@ -8,6 +8,7 @@
#include "dap_http_client.h"
#include "dap_client.h"
#include "dap_client_pvt.h"
#include "dap_stream_ch_proc.h"
......@@ -216,6 +217,11 @@ void m_stage_fsm_operator(dap_client_t * a_client, void * a_arg)
{
(void *) a_arg;
dap_client_pvt_t * l_client_internal = DAP_CLIENT_PVT(a_client);
if(!l_client_internal){
log_it(L_ERROR, "FSM Op: l_client_internal is NULL!");
return;
}
if (l_client_internal->stage_target == l_client_internal->stage){
log_it(L_WARNING, "FSM Op: current stage %s is same as target one, nothing to do",
dap_client_stage_str( l_client_internal->stage ) );
......@@ -254,6 +260,12 @@ void dap_client_request_enc(dap_client_t * a_client, const char * a_path, const
dap_client_pvt_request_enc(l_client_internal, a_path, a_suburl, a_query,a_request,a_request_size, a_response_proc,a_response_error);
}
void dap_client_request(dap_client_t * a_client, const char * a_full_path, void * a_request, size_t a_request_size,
dap_client_callback_data_size_t a_response_proc, dap_client_callback_int_t a_response_error )
{
dap_client_pvt_t * l_client_internal = DAP_CLIENT_PVT(a_client);
dap_client_pvt_request(l_client_internal, a_full_path, a_request, a_request_size, a_response_proc, a_response_error);
}
/**
......@@ -342,6 +354,7 @@ const char * dap_client_stage_str(dap_client_stage_t a_stage)
case STAGE_ENC_INIT: return "ENC";
case STAGE_STREAM_CTL: return "STREAM_CTL";
case STAGE_STREAM_SESSION: return "STREAM_SESSION";
case STAGE_STREAM_CONNECTED: return "STREAM_CONNECTED";
case STAGE_STREAM_STREAMING: return "STREAM";
default: return "UNDEFINED";
}
......@@ -366,6 +379,32 @@ dap_enc_key_t * dap_client_get_key_stream(dap_client_t * a_client){
}
/**
* @brief dap_client_get_stream
* @param a_client
* @return
*/
dap_stream_t * dap_client_get_stream(dap_client_t * a_client)
{
dap_client_pvt_t * l_client_internal = DAP_CLIENT_PVT(a_client);
return (l_client_internal) ? l_client_internal->stream : NULL;
}
dap_stream_ch_t * dap_client_get_stream_ch(dap_client_t * a_client, uint8_t a_ch_id)
{
dap_stream_ch_t * l_ch = NULL;
dap_client_pvt_t * l_client_internal = DAP_CLIENT_PVT(a_client);
if(l_client_internal && l_client_internal->stream)
for(int i = 0; i < l_client_internal->stream->channel_count; i++) {
dap_stream_ch_proc_t *l_ch_id = l_client_internal->stream->channel[i]->proc;
if(l_client_internal->stream->channel[i]->proc->id == a_ch_id) {
l_ch = l_client_internal->stream->channel[i];
break;
}
}
return l_ch;
}
/**
* @brief dap_client_get_stream_id
* @param a_client
......@@ -373,5 +412,8 @@ dap_enc_key_t * dap_client_get_key_stream(dap_client_t * a_client){
*/
const char * dap_client_get_stream_id(dap_client_t * a_client)
{
dap_client_pvt_t * l_client_internal = DAP_CLIENT_PVT(a_client);
if(!l_client_internal)
return NULL;
return DAP_CLIENT_PVT(a_client)->stream_id;
}
......@@ -26,6 +26,9 @@
#include <stdint.h>
#include "dap_enc_key.h"
#include "dap_events.h"
#include "dap_stream.h"
#include "dap_stream_ch.h"
/**
* @brief The dap_client_stage enum. Top level of client's state machine
**/
......@@ -77,7 +80,7 @@ typedef void (*dap_client_callback_data_size_t) (dap_client_t *, void *, size_t)
#define DAP_UPLINK_PATH_ENC_INIT "enc_init" //"1901248124123459"
#define DAP_UPLINK_PATH_DB "01094787531354"
#define DAP_UPLINK_PATH_STREAM_CTL "stream_ctl" //"091348758013553"
#define DAP_UPLINK_PATH_STREAM "874751843144"
#define DAP_UPLINK_PATH_STREAM "stream" //"874751843144"
#define DAP_UPLINK_PATH_LICENSE "license"
#define DAP_UPLINK_PATH_SERVER_LIST "slist"
......@@ -108,6 +111,9 @@ void dap_client_reset(dap_client_t * a_client);
void dap_client_request_enc(dap_client_t * a_client, const char * a_path,const char * a_suburl,const char* a_query, void * a_request, size_t a_request_size,
dap_client_callback_data_size_t a_response_proc, dap_client_callback_int_t a_response_error);
void dap_client_request(dap_client_t * a_client, const char * a_full_path, void * a_request, size_t a_request_size,
dap_client_callback_data_size_t a_response_proc, dap_client_callback_int_t a_response_error);
const char * dap_client_get_stage_str(dap_client_t * a_client);
const char * dap_client_stage_str(dap_client_stage_t a_stage);
......@@ -118,6 +124,8 @@ const char * dap_client_error_str(dap_client_error_t a_client_error);
const char * dap_client_get_error_str(dap_client_t * a_client);
const char * dap_client_get_auth_cookie(dap_client_t * a_client);
dap_stream_t * dap_client_get_stream(dap_client_t * a_client);
dap_stream_ch_t * dap_client_get_stream_ch(dap_client_t * a_client, uint8_t a_ch_id);
const char * dap_client_get_stream_id(dap_client_t * a_client);
dap_client_stage_t dap_client_get_stage(dap_client_t * a_client);
......
This diff is collapsed.
Subproject commit 600ed913252c001580ad0549d27e563c2f68be10
Subproject commit 999a4bc46231c2398a8d010dee06628965b3c478
Subproject commit f5f7c68a364d5230696c23db05730fb0aacd8089
Subproject commit 1b3a871d6ec93801f14081de51157bbb703593f1
Subproject commit edf554c77e05146aee6a90a6a15fab28ba38b626
Subproject commit 7c6065bc699760e6e66ee4e80861a3562b2366c1
Subproject commit 19a6376646f497d97bfe1ea3fade1a907c32f76a
Subproject commit 9b68cf5b9375e19e2db11a21f7ed0fd9b2b71c7f
Subproject commit 8fa982b5333a4ea85429fe772987f9d84e5fb96e
Subproject commit f5ba302012357d175ff532d11125699bcc8bcc96
Subproject commit dfbdaa1df0498069e60ffaf42de963375bffa816
Subproject commit d2257789e0c796a5a3b637e14dcbaf8a8c7880cc
Subproject commit b76175acc517f085c319c8e66c62bd143f96bf94
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