|
Teonet library
0.4.7
|
#include <ev.h>#include <pbl.h>#include "modules/cque.h"#include "net_com.h"#include "subscribe.h"#include "teonet_l0_client.h"Go to the source code of this file.
Data Structures | |
| struct | ksnLNullData |
| File: l0-server.h Author: Kirill Scherba kirill@scherba.ru More... | |
| struct | ksnLNullClass |
| ksnLNull Class structure definition More... | |
| struct | ksnLNullSPacket |
| L0 Server resend to peer packet data structure. More... | |
Typedefs | |
| typedef struct ksnLNullData | ksnLNullData |
| File: l0-server.h Author: Kirill Scherba kirill@scherba.ru More... | |
| typedef struct ksnLNullClass | ksnLNullClass |
| ksnLNull Class structure definition More... | |
| typedef struct ksnLNullSPacket | ksnLNullSPacket |
| L0 Server resend to peer packet data structure. More... | |
Functions | |
| ksnLNullClass * | ksnLNullInit (void *ke) |
| Initialize ksnLNull module class. More... | |
| void | ksnLNullDestroy (ksnLNullClass *kl) |
| Destroy ksnLNull module class. More... | |
| int | ksnLNullSendToL0 (void *ke, char *addr, int port, char *cname, size_t cname_length, uint8_t cmd, void *data, size_t data_len) |
| Send data to L0 client. More... | |
| int | ksnLNullSendEchoToL0 (void *ke, char *addr, int port, char *cname, size_t cname_length, void *data, size_t data_len) |
| Send echo to L0 client. More... | |
| int | ksnLNullSendEchoToL0A (void *ke, char *addr, int port, char *cname, size_t cname_length, void *data, size_t data_len) |
| int | ksnLNullClientIsConnected (ksnLNullClass *kl, char *client_name) |
| Check if L0 client is connected and return it FD. More... | |
| teonet_client_data_ar * | ksnLNullClientsList (ksnLNullClass *kl) |
| Create list of clients. More... | |
| size_t | ksnLNullClientsListLength (teonet_client_data_ar *clients_data) |
| Return size of teonet_client_data_ar data. More... | |
| ksnLNullSStat * | ksnLNullStat (ksnLNullClass *kl) |
| Get L0 server statistic. More... | |
| int | ksnLNulltrudpCheckPaket (ksnLNullClass *kl, ksnCorePacketData *rd) |
| Check and process L0 packet received through TR-UDP. More... | |
| ssize_t | ksnLNullPacketSend (ksnLNullClass *kl, int fd, void *pkg, size_t pkg_length) |
| Send packet to L0 client. More... | |
| void | ksnLNullClientDisconnect (ksnLNullClass *kl, int fd, int remove_f) |
| Disconnect l0 Server client. More... | |
| teoLNullEncryptionContext * | ksnLNullClientGetCrypto (ksnLNullClass *kl, int fd) |
| Returns L0 client encryption context and return it if available. More... | |
| typedef struct ksnLNullClass ksnLNullClass |
ksnLNull Class structure definition
| typedef struct ksnLNullData ksnLNullData |
File: l0-server.h Author: Kirill Scherba kirill@scherba.ru
Created on October 8, 2015, 1:39 PM L0 Server map data structure
| typedef struct ksnLNullSPacket ksnLNullSPacket |
L0 Server resend to peer packet data structure.
| void ksnLNullClientDisconnect | ( | ksnLNullClass * | kl, |
| int | fd, | ||
| int | remove_f | ||
| ) |
Disconnect l0 Server client.
Called when client disconnected or when the L0 Server closing. Close TCP connections and remove data from L0 Server clients map.
| kl | Pointer to ksnLNullClass |
| fd | TCP client connection file descriptor |
| remove_f | If true than remove disconnected record from map |
References _send_subscribe_event_disconnected(), CONNECT, ksnetEvMgrClass::ev_loop, EVENT_MANAGER_OBJECT, free(), ksn_printf, malloc(), ksnLNullClass::map, ksnLNullClass::map_n, MODULE, ksnLNullData::name, ksnLNullData::name_length, pblMapRemoveFree(), ksnLNullData::read_buffer, ksnLNullData::read_buffer_ptr, ksnLNullData::read_buffer_size, ksnLNullData::server_crypt, ksnLNullClass::stat, ksnLNullData::t_addr, and ksnLNullData::w.
Referenced by _check_connected(), cmd_l0_kick_client(), ksnLNulltrudpCheckPaket(), and trudp_event_cb().
| teoLNullEncryptionContext* ksnLNullClientGetCrypto | ( | ksnLNullClass * | kl, |
| int | fd | ||
| ) |
Returns L0 client encryption context and return it if available.
| kl | Pointer to ksnLNullClass |
| fd | Client name connection fd |
References ksnLNullData::server_crypt.
| int ksnLNullClientIsConnected | ( | ksnLNullClass * | kl, |
| char * | client_name | ||
| ) |
Check if L0 client is connected and return it FD.
| kl | Pointer to ksnLNullClass |
| client_name | Client name |
References ksnLNullClass::map_n.
Referenced by cmd_l0_check_cb(), cmd_l0_kick_client(), cmd_l0_to_cb(), and ksnCoreSendCmdto().
| teonet_client_data_ar* ksnLNullClientsList | ( | ksnLNullClass * | kl | ) |
Create list of clients.
| kl |
References EVENT_MANAGER_OBJECT, ksnLNullClass::fd, teonet_cfg::l0_allow_f, malloc(), ksnLNullClass::map, ksnLNullData::name, and ksnetEvMgrClass::teo_cfg.
|
inline |
Return size of teonet_client_data_ar data.
| clients_data |
| void ksnLNullDestroy | ( | ksnLNullClass * | kl | ) |
Destroy ksnLNull module class.
| kl | Pointer to ksnLNullClass |
References free(), ksnLNullClass::map, and ksnLNullClass::map_n.
Referenced by modules_destroy().
| ksnLNullClass* ksnLNullInit | ( | void * | ke | ) |
Initialize ksnLNull module class.
| ke | Pointer to ksnetEvMgrClass |
References ksnLNullClass::fd_trudp, ksnLNullClass::ke, ke, malloc(), ksnLNullClass::map, ksnLNullClass::map_n, and ksnLNullClass::stat.
Referenced by modules_init().
| ssize_t ksnLNullPacketSend | ( | ksnLNullClass * | kl, |
| int | fd, | ||
| void * | pkg, | ||
| size_t | pkg_length | ||
| ) |
Send packet to L0 client.
| fd | L0 client socket |
| pkg | Package to send |
| pkg_length | Package length |
< Remote address
< Remote address length
References CMD_TRUDP_CHECK, dump_bytes(), EVENT_MANAGER_OBJECT, ksnLNullClass::ke, ksn_printf, ksnTRUDPsendto(), MODULE, ksnLNullData::server_crypt, ksnLNullClass::stat, ksnLNullData::t_addr, and ksnLNullData::t_port.
Referenced by _check_connected(), cmd_l0_to_cb(), and ksnCoreSendCmdto().
| int ksnLNullSendEchoToL0 | ( | void * | ke, |
| char * | addr, | ||
| int | port, | ||
| char * | cname, | ||
| size_t | cname_length, | ||
| void * | data, | ||
| size_t | data_len | ||
| ) |
Send echo to L0 client.
| ke | Pointer to ksnetEvMgrClass |
| addr | IP address of remote peer |
| port | Port of remote peer |
| cname | L0 client name (include trailing zero) |
| cname_length | Length of the L0 client name |
| data | Data |
| data_len | Data length |
References CMD_ECHO, free(), kc, ksnCommandEchoBuffer(), and ksnLNullSendToL0().
Referenced by teo::Teonet::sendEchoToL0().
| int ksnLNullSendEchoToL0A | ( | void * | ke, |
| char * | addr, | ||
| int | port, | ||
| char * | cname, | ||
| size_t | cname_length, | ||
| void * | data, | ||
| size_t | data_len | ||
| ) |
| int ksnLNullSendToL0 | ( | void * | ke, |
| char * | addr, | ||
| int | port, | ||
| char * | cname, | ||
| size_t | cname_length, | ||
| uint8_t | cmd, | ||
| void * | data, | ||
| size_t | data_len | ||
| ) |
Send data to L0 client.
Usually it is an answer to request from L0 client
| ke | Pointer to ksnetEvMgrClass |
| addr | IP address of remote peer |
| port | Port of remote peer |
| cname | L0 client name (include trailing zero) |
| cname_length | Length of the L0 client name |
| cmd | Command |
| data | Data |
| data_len | Data length |
References ksnLNullSPacket::client_name_length, ksnLNullSPacket::cmd, CMD_L0_TO, ksnLNullSPacket::data_length, DEBUG_VV, free(), kc, ksn_printf, ksnCoreSendto(), malloc(), MODULE, and ksnLNullSPacket::payload.
Referenced by ksnLNullSendEchoToL0(), sendCmdAnswerToBinaryA(), teo::Teonet::sendToL0(), and teoSScrSend().
| ksnLNullSStat* ksnLNullStat | ( | ksnLNullClass * | kl | ) |
Get L0 server statistic.
| kl | Pointer to ksnLNullClass |
References ksnLNullClass::stat.
Referenced by metric_teonet_count().
| int ksnLNulltrudpCheckPaket | ( | ksnLNullClass * | kl, |
| ksnCorePacketData * | rd | ||
| ) |
Check and process L0 packet received through TR-UDP.
| data | |
| data_len |
References ksnCorePacketData::addr, ksnCorePacketData::cmd, ksnCorePacketData::data, ksnCorePacketData::data_len, DEBUG_VV, EVENT_MANAGER_OBJECT, ksnLNullClass::fd, ksnetEvMgrClass::kc, ksn_printf, ksnLNullClientDisconnect(), ksnCoreClass::ku, MODULE, ksnCorePacketData::port, and recvCheck().
Referenced by ksnCoreProcessPacket().