67 lines
2.3 KiB
C
67 lines
2.3 KiB
C
#ifndef __TEEX_SERVICE_H__
|
|
#define __TEEX_SERVICE_H__
|
|
|
|
#include "teex/error.h"
|
|
#include "teex/file.h"
|
|
|
|
typedef struct teex_service_t {
|
|
char * serviceID; /* ID for the service */
|
|
char * price; /* price paid for the service provider */
|
|
char * workerFeerate; /* token paid for the worker */
|
|
char * desc; /* description of the service */
|
|
char * providerAddr; /* wallet address of the service provider */
|
|
char * publicKey; /* public key of the service */
|
|
char * privateKey; /* private key of the service */
|
|
|
|
teexFile *code; /* code of the service */
|
|
char * codeEntry; /* entry file of the service */
|
|
char * codeHash; /* hash of the service code */
|
|
char * runtime; /* runtime used by the service. e.g., python2.7 */
|
|
|
|
int dataNumber; /* number of data used by the service */
|
|
char **dataList; /* the data list */
|
|
} teexService;
|
|
|
|
|
|
|
|
/* createServiceOnChain
|
|
* Purpose: Create a service on the blockchain and get the serviceID.
|
|
*
|
|
* Parameters:
|
|
* chainAddr - [IN] address of the chain node.
|
|
* chainPort - [IN] port of the chain node.
|
|
* privateKey - [IN] private key of the service provider's wallet.
|
|
* publicKey - [IN] public key of the service provider's wallet.
|
|
* serviceContractAddr - [IN] the smart contract address of the TEEX service.
|
|
* tokenContractAddr - [IN] the smart contract address of the TEEX token.
|
|
* serviceInfo - [IN] the service information w/o the service ID.
|
|
* serviceID - [OUT] the service ID generated by the blockchain.
|
|
* timeout - [IN] time for confirming the created service onchain, in seconds
|
|
*
|
|
* Return value:
|
|
* teex_status_t - TEEX_SUCCESS or failure as defined in error.h
|
|
*/
|
|
teex_status_t createServiceOnChain(char *chainAddr, int chainPort,
|
|
char *privateKey, char *publicKey,
|
|
char *serviceContractAddr, char *tokenContractAddr,
|
|
teexService *serviceInfo, char **serviceID,
|
|
unsigned int timeout);
|
|
|
|
|
|
/* deployService
|
|
*
|
|
* Parameters:
|
|
* managerAddr - [IN] address of a TEEX service manager.
|
|
* managerPort - [IN] port of a TEEX service manager.
|
|
* serviceInfo - [IN] the service information.
|
|
* errMsg - [OUT] the error message from the TEEX Service Manager.
|
|
*
|
|
* Return value:
|
|
* teex_status_t - TEEX_SUCCESS or failure as defined in error.h
|
|
*/
|
|
teex_status_t deployService(char *managerAddr, int managerPort,
|
|
teexService *serviceInfo,
|
|
char **errMsg);
|
|
|
|
#endif
|