Teonet library
0.4.7
|
Go to the source code of this file.
Data Structures | |
struct | ksnStreamMapData |
File: stream.h Author: Kirill Scherba kiril l@sc herba .ruMore... | |
struct | ksnStreamData |
Stream map data structure. More... | |
struct | stream_packet |
Stream packet data structure. More... | |
struct | ksnStreamClass |
Stream module class structure. More... | |
Typedefs | |
typedef struct ksnStreamMapData | ksnStreamMapData |
File: stream.h Author: Kirill Scherba kiril l@sc herba .ruMore... | |
typedef struct ksnStreamData | ksnStreamData |
Stream map data structure. More... | |
typedef struct ksnStreamClass | ksnStreamClass |
Stream module class structure. More... | |
Enumerations | |
enum | stream_cmd { CMD_ST_NONE, CMD_ST_CREATE, CMD_ST_CREATE_GOT, CMD_ST_CREATED, CMD_ST_DATA, CMD_ST_CLOSE, CMD_ST_CLOSE_GOT, CMD_ST_CLOSE_NOTREMOVE } |
Stream subcommands. More... | |
Functions | |
ksnStreamClass * | ksnStreamInit (void *ke) |
Initialize Stream module. More... | |
void | ksnStreamDestroy (ksnStreamClass *ks) |
Stream module destroy. More... | |
int | ksnStreamCreate (ksnStreamClass *ks, char *to_peer, char *stream_name, int send_f) |
Create new named stream with selected peer. More... | |
int | ksnStreamClose (ksnStreamClass *ks, char *to_peer, char *stream_name, int send_f) |
Close named stream with selected peer. More... | |
int | ksnStreamClosePeer (ksnStreamClass *ks, const char *peer_name) |
Close all streams connected to selected peer. More... | |
ksnStreamData * | ksnStreamGetDataFromMap (ksnStreamData *sd, ksnStreamMapData *smd) |
Get stream data. More... | |
ksnStreamMapData * | ksnStreamGetMapData (ksnStreamClass *ks, void *key, size_t key_len) |
Get stream map data by key. More... | |
typedef struct ksnStreamClass ksnStreamClass |
Stream module class structure.
typedef struct ksnStreamData ksnStreamData |
Stream map data structure.
typedef struct ksnStreamMapData ksnStreamMapData |
enum stream_cmd |
Stream subcommands.
int ksnStreamClose | ( | ksnStreamClass * | ks, |
char * | to_peer, | ||
char * | stream_name, | ||
int | send_f | ||
) |
Close named stream with selected peer.
ks | |
to_peer | |
stream_name | |
send_f |
References CMD_ST_CLOSE, CMD_ST_CLOSE_GOT, CMD_ST_CLOSE_NOTREMOVE, ksnStreamMapData::created, DEBUG_VV, EV_K_STREAM_DISCONNECTED, free(), kev, ksnStreamMapData::key, ksn_printf, ksnStreamSendTo(), ksnStreamClass::map, MODULE, pblMapRemoveFree(), stream_packet::stream_name_len, ksnStreamMapData::w_in, and ksnStreamMapData::w_out.
Referenced by cmd_stream_cb(), kq_connect_cb(), ksnStreamCloseAll(), and ksnStreamClosePeer().
int ksnStreamClosePeer | ( | ksnStreamClass * | ks, |
const char * | peer_name | ||
) |
Close all streams connected to selected peer.
ks | |
peer_name |
References CMD_ST_CLOSE_GOT, ksnStreamClose(), ksnStreamClosePeer(), and ksnStreamClass::map.
Referenced by ksnetArpRemove(), and ksnStreamClosePeer().
int ksnStreamCreate | ( | ksnStreamClass * | ks, |
char * | to_peer, | ||
char * | stream_name, | ||
int | send_f | ||
) |
Create new named stream with selected peer.
ks | |
to_peer | |
stream_name | |
send_f | CMD_ST_CREATE - create pipes and send CREATE request to peer; CMD_ST_CREATE_GOT - CREATE command received, create pipes and send CREATED response CMD_ST_CREATED - CREATED command received |
References CMD_ST_CREATE, CMD_ST_CREATE_GOT, CMD_ST_CREATED, connect_watchers(), ksnStreamMapData::cq, ksnStreamMapData::created, data, DEBUG_VV, ksnCQueData::id, ksnStreamMapData::ke, kev, ksnStreamMapData::key, ksnStreamMapData::key_len, kq_connect_cb(), ksn_printf, KSN_STREAM_CONNECT_TIMEOUT, ksnCQueAdd(), ksnCQueExec(), ksnStreamSendTo(), malloc(), ksnStreamClass::map, MODULE, ksnStreamMapData::pipe_in, ksnStreamMapData::pipe_out, and stream_packet::stream_name_len.
Referenced by cmd_stream_cb(), and event_cb().
void ksnStreamDestroy | ( | ksnStreamClass * | ks | ) |
Stream module destroy.
ks | Pointer to ksnStreamClass |
References free(), ksnStreamCloseAll(), and ksnStreamClass::map.
Referenced by modules_destroy().
ksnStreamData* ksnStreamGetDataFromMap | ( | ksnStreamData * | sd, |
ksnStreamMapData * | smd | ||
) |
Get stream data.
sd | Pointer to ksnStreamData |
smd | Pointer to ksnStreamMapData |
References ksnStreamData::fd_in, ksnStreamData::fd_out, ksnStreamMapData::key, ksnStreamData::peer_name, ksnStreamMapData::pipe_in, ksnStreamMapData::pipe_out, and ksnStreamData::stream_name.
Referenced by event_cb().
ksnStreamMapData* ksnStreamGetMapData | ( | ksnStreamClass * | ks, |
void * | key, | ||
size_t | key_len | ||
) |
Get stream map data by key.
ks | |
key | |
key_len |
References data, and ksnStreamClass::map.
Referenced by event_cb().
ksnStreamClass* ksnStreamInit | ( | void * | ke | ) |
Initialize Stream module.
ke | Pointer to |
References ke, ksnStreamClass::ke, malloc(), and ksnStreamClass::map.
Referenced by modules_init().