Teonet library  0.4.7
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
teoWSClass Struct Reference

Websocket L0 connector class data. More...

#include <teo_ws.h>

Data Fields

ksnHTTPClasskh
 Pointer to ksnHTTPClass. More...
 
PblMap * map
 Hash Map to store websocket clients. More...
 
void(* destroy )(teoWSClass *kws)
 Destroy teonet HTTP module]. More...
 
teoLNullConnectData *(* add )(teoWSClass *kws, void *nc_p, const char *server, const int port, char *login)
 Connect WS client with L0 server and add it to connected map and create READ watcher. More...
 
int(* remove )(teoWSClass *kws, void *nc_p)
 
int(* handler )(teoWSClass *kws, int ev, void *nc_p, void *data, size_t data_length)
 Teonet L0 websocket event handler. More...
 
ssize_t(* send )(teoWSClass *kws, void *nc_p, int cmd, const char *to_peer_name, void *data, size_t data_length)
 Send command to L0 server. More...
 
int(* processMsg )(teoWSClass *kws, void *nc_p, void *data, size_t data_length)
 Process websocket message. More...
 

Detailed Description

Websocket L0 connector class data.

Field Documentation

teoLNullConnectData*(* teoWSClass::add)(teoWSClass *kws, void *nc_p, const char *server, const int port, char *login)

Connect WS client with L0 server and add it to connected map and create READ watcher.

Parameters
kwsPointer to teoWSClass
nc_pPointer to websocket connector
serverL0 Server name or IP
portL0 Server port
loginL0 server login
Returns
Pointer to teoLNullConnectData or NULL if error
void(* teoWSClass::destroy)(teoWSClass *kws)

Destroy teonet HTTP module].

Parameters
kwsPointer to teoWSClass
int(* teoWSClass::handler)(teoWSClass *kws, int ev, void *nc_p, void *data, size_t data_length)

Teonet L0 websocket event handler.

Parameters
kwsPointer to teoWSClass
evEvent
nc_pPointer to mg_connection structure
dataWebsocket data
data_lengthWebsocket data length
Returns
True if event processed
ksnHTTPClass* teoWSClass::kh

Pointer to ksnHTTPClass.

PblMap* teoWSClass::map

Hash Map to store websocket clients.

int(* teoWSClass::processMsg)(teoWSClass *kws, void *nc_p, void *data, size_t data_length)

Process websocket message.

Parameters
kwsPointer to teoWSClass
nc_pPointer to mg_connection structure
dataWebsocket data
data_lengthWebsocket data length
Returns
True if message processed
int(* teoWSClass::remove)(teoWSClass *kws, void *nc_p)
ssize_t(* teoWSClass::send)(teoWSClass *kws, void *nc_p, int cmd, const char *to_peer_name, void *data, size_t data_length)

Send command to L0 server.

Create L0 clients packet and send it to L0 server

Parameters
conPointer to teoLNullConnectData
cmdCommand
peer_namePeer name to send to
dataPointer to data
data_lengthLength of data
Returns
Length of send data or -1 at error

The documentation for this struct was generated from the following file: