Teonet library  0.4.7
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
teodb_ex.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "ev_mgr.h"
#include "modules/teodb_com.h"

Macros

#define TDB_VERSION   "0.0.1"
 
#define APPNAME   _ANSI_MAGENTA "teodb_ex" _ANSI_NONE
 
#define TEODB_PEER   ke->teo_cfg.app_argv[1]
 
#define TEODB_EX_KEY   "teo_db_ex"
 
#define TEST_KEY   "test"
 
#define TEST_VALUE   "{ \"name\": \"1\" }"
 
#define ke   cqd->ke
 
#define NUM_RECORDS_TO_SHOW   "25"
 
#define ke   cqd->ke
 
#define KEY   "teo_db_ex."
 

Typedefs

typedef struct get_cq_data get_cq_data
 

Functions

void list_cb (uint32_t id, int type, void *data)
 Callback Queue callback (the same as callback queue event). More...
 
void get_cb (uint32_t id, int type, void *data)
 Callback Queue callback (the same as callback queue event). More...
 
void event_cb (ksnetEvMgrClass *ke, ksnetEvMgrEvents event, void *data, size_t data_len, void *user_data)
 Teonet Events callback. More...
 
int main (int argc, char **argv)
 Main Teonet Database example function. More...
 

Detailed Description

Macro Definition Documentation

#define APPNAME   _ANSI_MAGENTA "teodb_ex" _ANSI_NONE
Examples:
teodb_ex.c.

Referenced by main().

#define ke   cqd->ke
#define KEY   "teo_db_ex."
Examples:
teodb_ex.c.

Referenced by get_cb().

#define NUM_RECORDS_TO_SHOW   "25"
Examples:
teodb_ex.c.

Referenced by event_cb(), and list_cb().

#define TDB_VERSION   "0.0.1"
Examples:
teodb_ex.c.

Referenced by main().

#define TEODB_EX_KEY   "teo_db_ex"
Examples:
teodb_ex.c.

Referenced by event_cb().

#define TEODB_PEER   ke->teo_cfg.app_argv[1]
Examples:
teodb_ex.c.

Referenced by event_cb(), and get_cb().

#define TEST_KEY   "test"
Examples:
teodb_ex.c.

Referenced by event_cb().

#define TEST_VALUE   "{ \"name\": \"1\" }"
Examples:
teodb_ex.c.

Referenced by event_cb().

Typedef Documentation

typedef struct get_cq_data get_cq_data
Examples:
teodb_ex.c.

Function Documentation

void event_cb ( ksnetEvMgrClass ke,
ksnetEvMgrEvents  event,
void *  data,
size_t  data_len,
void *  user_data 
)
void get_cb ( uint32_t  id,
int  type,
void *  data 
)

Callback Queue callback (the same as callback queue event).

This function calls at timeout or after ksnCQueExec calls

Parameters
idCalls ID
typeType: 0 - timeout callback; 1 - successful callback
dataUser data
Examples:
teodb_ex.c.

References CMD_D_LIST, cq, data, free(), ksnCQueData::id, ke, KEY, ksnCoreSendCmdto(), ksnCQueAdd(), list_cb(), memdup(), prepare_request_data(), and TEODB_PEER.

Referenced by event_cb().

void list_cb ( uint32_t  id,
int  type,
void *  data 
)

Callback Queue callback (the same as callback queue event).

This function calls at timeout or after ksnCQueExec calls

Parameters
idCalls ID
typeType: 0 - timeout callback; 1 - successful callback
dataUser data
Examples:
teodb_ex.c.

References data, free(), and NUM_RECORDS_TO_SHOW.

Referenced by get_cb().

int main ( int  argc,
char **  argv 
)

Main Teonet Database example function.

Parameters
argcNumber of arguments
argvArguments array
Returns
Examples:
teodb_ex.c.

References ksnetEvMgrAppParam::app_argc, ksnetEvMgrAppParam::app_argv, ksnetEvMgrAppParam::app_descr, APP_PARAM, APPNAME, event_cb(), ke, ksn_puts, ksnetEvMgrInitPort(), ksnetEvMgrRun(), MESSAGE, READ_CONFIGURATION, READ_OPTIONS, TDB_VERSION, teoSetAppType(), and VERSION.