Teonet library  0.4.7
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
async_calls.c File Reference
#include "ev_mgr.h"
#include "async_calls.h"

Macros

#define MODULE   "async_module"
 
#define kev   ((ksnetEvMgrClass*)(ke))
 
#define MULTITHREADED()   (kev->ta->f_multi_thread == MULTITHREAD)
 
#define NO_MULTITHREADED()   (kev->ta->f_multi_thread == NO_MULTITHREAD)
 
#define SEND_CONDITION()   ((ud->rv >= 0 || ud->rv == CHSQ_WRONG_PEER) && ud->rv < SEND_IF)
 
#define SET_TIMEOUT()
 
#define CHECK_RETRIVES   10
 
#define LOCK_CV()   pthread_mutex_lock(&kev->ta->cv_mutex);
 
#define UNLOCK_CV()   pthread_mutex_unlock(&kev->ta->cv_mutex);
 
#define SEND_ASYNC(buf, buf_length)
 

Typedefs

typedef struct async_data async_data
 

Enumerations

enum  CHECK_SEND_QUEUE { CHSQ_WRONG_REQUEST = -2, CHSQ_WRONG_PEER = -3, CHSQ_WRONG_ADDRESS = -4, CHSQ_TIMEOUT = -5 }
 
enum  MULTITHREAD { NOT_DEFINED_MULTITHREAD = 0, MULTITHREAD = 1, NO_MULTITHREAD = 2 }
 
enum  ASYNC_FUNC { KSN_CORE_SEND_CMD_TO = 1, TEO_SSCR_SEND = 2, SEND_CMD_ANSWER_TO = 3, TEO_SSCR_SUBSCRIBE = 4 }
 

Functions

void teoAsyncTest (void *ke)
 
teoAsyncClassteoAsyncInit (void *ke)
 Async module initialize. More...
 
void teoAsyncDestroy (teoAsyncClass *ta)
 Async module destroy and free allocated memory. More...
 
void ksnCoreSendCmdtoA (void *ke, const char *peer, uint8_t cmd, void *data, size_t data_length)
 
void teoSScrSendA (void *ke, uint16_t event, void *data, size_t data_length, uint8_t cmd)
 
void sendCmdAnswerToBinaryA (void *ke, void *rdp, uint8_t cmd, void *data, size_t data_length)
 
void teoSScrSubscribeA (teoSScrClass *sscr, char *peer, uint16_t ev)
 Send command to subscribe this host to event at remote peer. More...
 

Macro Definition Documentation

#define CHECK_RETRIVES   10
#define LOCK_CV ( )    pthread_mutex_lock(&kev->ta->cv_mutex);
#define MULTITHREADED ( )    (kev->ta->f_multi_thread == MULTITHREAD)
#define NO_MULTITHREADED ( )    (kev->ta->f_multi_thread == NO_MULTITHREAD)
#define SEND_ASYNC (   buf,
  buf_length 
)
#define SEND_CONDITION ( )    ((ud->rv >= 0 || ud->rv == CHSQ_WRONG_PEER) && ud->rv < SEND_IF)
#define SET_TIMEOUT ( )
Value:
gettimeofday(&now,NULL); \
t = now.tv_usec + now.tv_sec * 1000000 + timeout; \
now.tv_sec = t / 1000000; \
now.tv_usec = t % 1000000; \
timeToWait.tv_sec = now.tv_sec; \
timeToWait.tv_nsec = now.tv_usec * 1000
#define UNLOCK_CV ( )    pthread_mutex_unlock(&kev->ta->cv_mutex);

Typedef Documentation

typedef struct async_data async_data

Enumeration Type Documentation

enum ASYNC_FUNC
Enumerator
KSN_CORE_SEND_CMD_TO 
TEO_SSCR_SEND 
SEND_CMD_ANSWER_TO 
TEO_SSCR_SUBSCRIBE 
Enumerator
CHSQ_WRONG_REQUEST 
CHSQ_WRONG_PEER 
CHSQ_WRONG_ADDRESS 
CHSQ_TIMEOUT 
Enumerator
NOT_DEFINED_MULTITHREAD 
MULTITHREAD 
NO_MULTITHREAD 

Function Documentation

void ksnCoreSendCmdtoA ( void *  ke,
const char *  peer,
uint8_t  cmd,
void *  data,
size_t  data_length 
)
void teoAsyncDestroy ( teoAsyncClass ta)
void teoSScrSendA ( void *  ke,
uint16_t  event,
void *  data,
size_t  data_length,
uint8_t  cmd 
)
void teoSScrSubscribeA ( teoSScrClass sscr,
char *  peer_name,
uint16_t  ev 
)

Send command to subscribe this host to event at remote peer.

Parameters
sscrPointer to teoSScrClass
peer_nameRemote host name
evEvent

References DEBUG, teoSScrClass::ke, kev, ksn_printf, malloc(), MODULE, SEND_ASYNC, TEO_SSCR_SUBSCRIBE, and teoSScrSubscribe().

Referenced by teo::Teonet::subscribeA(), and teoAsyncTest().