diff --git a/CMakeLists.txt b/CMakeLists.txt index c08d21b3b403b06c447b8096ff373da139b12b02..f8f5de1c836c75968e98d9e64eeff72028fc06d6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,7 +40,9 @@ add_subdirectory(modules/dap-sdk/net/server/http) add_subdirectory(modules/dap-sdk/net/server/json_rpc) add_subdirectory(modules/cellframe-sdk/common) add_subdirectory(modules/cellframe-sdk/net) +add_subdirectory(modules/cellframe-sdk/net/srv) add_subdirectory(modules/cellframe-sdk/gdb) +add_subdirectory(modules/cellframe-sdk/global-db) add_subdirectory(modules/cellframe-sdk/chain) add_subdirectory(modules/cellframe-sdk/app-cli) add_subdirectory(modules/cellframe-sdk/wallet) @@ -50,6 +52,7 @@ add_subdirectory(modules/cellframe-sdk/type/dag) target_compile_options(dap_python_module PRIVATE "-fpic" ) target_compile_options(dap_crypto_python_module PRIVATE "-fpic" ) target_compile_options(dap_chain_net_python_module PRIVATE "-fpic") + target_compile_options(dap_chain_net_srv_python_module PRIVATE "-fpic") target_compile_options(dap_chain_gdb_python_module PRIVATE "-fpic") target_compile_options(dap_chain_python_module PRIVATE "-fpic") target_compile_options(dap_app_cli_python_module PRIVATE "-fpic") @@ -179,7 +182,9 @@ target_link_libraries(${PROJECT_NAME} cellframe-sdk dap_python_module dap_server_http_python_module dap_chain_python_module dap_chain_net_python_module + dap_chain_net_srv_python_module dap_chain_gdb_python_module + dap_chain_global_db_python_module dap_app_cli_python_module dap_chain_wallet_python_module dap_server_json_rpc_python_module diff --git a/modules/cellframe-sdk/net/include/libdap_chain_net_python.h b/modules/cellframe-sdk/net/include/libdap_chain_net_python.h index 36c62ceb9d7c44e047199db6bf0ae28af9cd22ea..04c9b11560c98f8949602b2b50b2146250fd72a7 100644 --- a/modules/cellframe-sdk/net/include/libdap_chain_net_python.h +++ b/modules/cellframe-sdk/net/include/libdap_chain_net_python.h @@ -76,8 +76,6 @@ PyObject *dap_chain_net_links_connect_py(PyObject *self, PyObject *args); PyObject *dap_chain_net_get_chain_by_chain_type_py(PyObject *self, PyObject *args); PyObject *dap_chain_net_get_ledger_py(PyObject *self, PyObject *args); PyObject *dap_chain_net_get_name_py(PyObject *self, PyObject *args); -PyObject *dap_chain_net_get_tx_by_hash_py(PyObject *self, PyObject *args); -PyObject *dap_chain_net_python_get_id(PyObject *self, void *closure); static PyMethodDef DapChainNetMethods[] = { {"loadAll", dap_chain_net_load_all_py, METH_NOARGS | METH_STATIC, ""}, @@ -102,12 +100,13 @@ static PyMethodDef DapChainNetMethods[] = { {"getChainByChainType", dap_chain_net_get_chain_by_chain_type_py, METH_VARARGS, ""}, {"getLedger", dap_chain_net_get_ledger_py, METH_NOARGS, ""}, {"getName", dap_chain_net_get_name_py, METH_NOARGS, ""}, - {"getTxByHash", dap_chain_net_get_tx_by_hash_py, METH_VARARGS, ""}, {NULL, NULL, 0, NULL} }; +PyObject *dap_chain_net_python_get_id(PyObject *self, void *closure); + static PyGetSetDef DapChainNetGetsSetsDef[] = { - {"id", (getter)dap_chain_net_python_get_id, NULL, NULL, NULL}, + {"id", (getter)dap_chain_net_python_get_id, NULL, NULL, NULL}, {NULL} }; @@ -140,9 +139,9 @@ static PyTypeObject DapChainNetObject_DapChainNetObjectType = { 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ - DapChainNetMethods, /* tp_methods */ - 0, /* tp_members */ - DapChainNetGetsSetsDef, /* tp_getset */ + DapChainNetMethods, /* tp_methods */ + 0, /* tp_members */ + DapChainNetGetsSetsDef, /* tp_getset */ 0, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ @@ -153,6 +152,10 @@ static PyTypeObject DapChainNetObject_DapChainNetObjectType = { PyType_GenericNew, /* tp_new */ }; +static bool PyDapChainNet_Check(PyObject *a_obj){ + return PyObject_TypeCheck(a_obj, &DapChainNetObject_DapChainNetObjectType); +} + #ifdef __cplusplus } #endif diff --git a/modules/cellframe-sdk/net/src/libdap_chain_net_python.c b/modules/cellframe-sdk/net/src/libdap_chain_net_python.c index 5d1a0c8d97d7bd6137adcefe3ee77344c6d7d6f2..3f83e3165f5da189eae0cb5fa547189740ddcfe4 100644 --- a/modules/cellframe-sdk/net/src/libdap_chain_net_python.c +++ b/modules/cellframe-sdk/net/src/libdap_chain_net_python.c @@ -107,6 +107,14 @@ PyObject *dap_chain_net_get_chain_by_name_py(PyObject *self, PyObject *args){ return Py_BuildValue("O", obj_chain); } +PyObject *dap_chain_net_python_get_id(PyObject *self, void *closure){ + (void)closure; + PyDapChainNetIdObject *obj_net_id = PyObject_New(PyDapChainNetIdObject, &DapChainNetIdObject_DapChainNetIdObjectType); + PyObject_Dir((PyObject*)obj_net_id); + obj_net_id->net_id = ((PyDapChainNetObject*)self)->chain_net->pub.id; + return (PyObject*)obj_net_id; +} + PyObject *dap_chain_net_get_cur_addr_py(PyObject *self, PyObject *args){ PyObject *obj_node_addr = _PyObject_New(&DapChainNodeAddrObject_DapChainNodeAddrObjectType); ((PyDapChainNodeAddrObject*)obj_node_addr)->node_addr = dap_chain_net_get_cur_addr(((PyDapChainNetObject*)self)->chain_net); @@ -167,27 +175,3 @@ PyObject *dap_chain_net_get_name_py(PyObject *self, PyObject *args){ PyObject *obj_name = PyUnicode_FromString(((PyDapChainNetObject*)self)->chain_net->pub.name); return obj_name; } - -PyObject *dap_chain_net_get_tx_by_hash_py(PyObject *self, PyObject *args){ - PyObject *obj_hash; - if (!PyArg_ParseTuple(args, "O", &obj_hash)){ - return NULL; - } - PyDapChainDatumTxObject *obj_tx = PyObject_New(PyDapChainDatumTxObject, &DapChainDatumTx_DapChainDatumTxObjectType); - PyObject_Dir((PyObject*)obj_tx); - obj_tx->datum_tx = dap_chain_net_get_tx_by_hash(((PyDapChainNetObject*)self)->chain_net, - ((PyDapHashFastObject*)obj_hash)->hash_fast, TX_SEARCH_TYPE_LOCAL); - if(obj_tx->datum_tx == NULL){ - Py_XDECREF(obj_tx); - return Py_None; - } - return (PyObject*)obj_tx; -} - -PyObject *dap_chain_net_python_get_id(PyObject *self, void *closure){ - (void)closure; - PyDapChainNetIdObject *obj_net_id = PyObject_New(PyDapChainNetObject, &DapChainNetIdObject_DapChainNetIdObjectType); - PyObject_Dir((PyObject*)obj_net_id); - obj_net_id->net_id = ((PyDapChainNetObject*)self)->chain_net->pub.id; - return (PyObject*)obj_net_id; -} diff --git a/modules/cellframe-sdk/net/src/wrapping_dap_app_cli_server.c b/modules/cellframe-sdk/net/src/wrapping_dap_app_cli_server.c index d8ebafb661d3a09412b6e0f156abf55619f5db83..b98191cd5750cd4af5263a810a79330dd4926376 100644 --- a/modules/cellframe-sdk/net/src/wrapping_dap_app_cli_server.c +++ b/modules/cellframe-sdk/net/src/wrapping_dap_app_cli_server.c @@ -100,7 +100,6 @@ void element_py_func_del_all(){ } static int wrapping_cmdfunc(int argc, char **argv, char **str_reply){ - PyGILState_STATE state = PyGILState_Ensure(); size_t id_str_replay = elements_str_reply_add(str_reply); PyObject *obj_argv = stringToPyList(argc, argv); PyObject *obj_id_str_replay = PyLong_FromSize_t(id_str_replay); @@ -115,7 +114,6 @@ static int wrapping_cmdfunc(int argc, char **argv, char **str_reply){ Py_XDECREF(arglist); Py_XDECREF(obj_argv); elements_str_reply_delete(id_str_replay); - PyGILState_Release(state); return 0; }