Skip to content
Snippets Groups Projects
Commit 30009ca6 authored by Aleksandr Lysikov's avatar Aleksandr Lysikov
Browse files

added struct dap_chain_net_srv_abstract_t

parent 467476c7
No related branches found
No related tags found
No related merge requests found
......@@ -8,19 +8,19 @@
This file is part of DAP (Deus Applications Prototypes) the open source project
DAP (Deus Applicaions Prototypes) is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
DAP is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with any DAP based project. If not, see <http://www.gnu.org/licenses/>.
*/
DAP (Deus Applicaions Prototypes) is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
DAP is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with any DAP based project. If not, see <http://www.gnu.org/licenses/>.
*/
#include "utlist.h"
......@@ -39,6 +39,7 @@ int dap_chain_net_srv_init()
{
m_uid = NULL;
m_uid_count = 0;
return 0;
}
......@@ -64,7 +65,7 @@ void dap_chain_net_srv_add(dap_chain_net_srv_t * a_srv)
* @param a_uid
* @return
*/
dap_chain_net_srv_t * dap_chain_net_srv_get( dap_chain_net_srv_uid_t a_uid)
dap_chain_net_srv_t * dap_chain_net_srv_get(dap_chain_net_srv_uid_t a_uid)
{
}
......
......@@ -8,24 +8,35 @@
This file is part of DAP (Deus Applications Prototypes) the open source project
DAP (Deus Applicaions Prototypes) is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
DAP is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with any DAP based project. If not, see <http://www.gnu.org/licenses/>.
*/
DAP (Deus Applicaions Prototypes) is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
DAP is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with any DAP based project. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "dap_chain_node_ctl.h"
#include "dap_chain_net_srv_common.h"
//Classes of services
enum {
SERV_CLASS_ONCE = 1, // one-time service
SERV_CLASS_PERMANENT = 2
};
//Types of services
enum {
SERV_ID_VPN = 1,
};
typedef struct dap_chain_net_srv
{
dap_chain_node_ctl_t * node;
......@@ -35,11 +46,33 @@ typedef struct dap_chain_net_srv
void * _inhertor;
} dap_chain_net_srv_t;
typedef struct dap_chain_net_srv_abstract
{
uint64_t proposal_id; // id trade proposal. Must be unique to the node.
uint8_t class; //Class of service
uint8_t type_id; //Type of service
union {
struct {
int bandwith;
int abuse_resistant;
int limit_bytes;
} vpn;
struct {
int value;
} other_srv;
} proposal_params;
uint64_t price; // service price, for SERV_CLASS_ONCE ONCE for the whole service, for SERV_CLASS_PERMANENT for one unit.
uint8_t price_units; // Unit of service (seconds, megabytes, etc.) Only for SERV_CLASS_PERMANENT
char decription[128];
} DAP_ALIGN_PACKED dap_chain_net_srv_abstract_t;
int dap_chain_net_srv_init();
void dap_chain_net_srv_deinit();
void dap_chain_net_srv_add(dap_chain_net_srv_t * a_srv);
dap_chain_net_srv_t * dap_chain_net_srv_get( dap_chain_net_srv_uid_t a_uid);
dap_chain_net_srv_t * dap_chain_net_srv_get(dap_chain_net_srv_uid_t a_uid);
const size_t dap_chain_net_srv_count();
const dap_chain_net_srv_uid_t * dap_chain_net_srv_list();
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