Teonet library  0.4.7
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
tr-udp.h File Reference
#include "trudp.h"

Go to the source code of this file.

Macros

#define make_addr(addr_str, port, addr, addr_len)   trudpUdpMakeAddr(addr_str, port, addr, addr_len)
 File: tr-udp.h Author: Kirill Scherba kiril.nosp@m.l@sc.nosp@m.herba.nosp@m..ru More...
 

Functions

ssize_t ksnTRUDPrecvfrom (trudpData *td, int fd, void *buffer, size_t buffer_len, int flags, __SOCKADDR_ARG addr, socklen_t *addr_len)
 Get data from peer through TR-UDP transport. More...
 
ssize_t ksnTRUDPsendto (trudpData *td, int resend_fl, uint32_t id, int attempt, int cmd, int fd, const void *buf, size_t buf_len, int flags, __CONST_SOCKADDR_ARG addr, socklen_t addr_len)
 Send to peer through TR-UDP transport. More...
 
void trudp_event_cb (void *tcd_pointer, int event, void *data, size_t data_length, void *user_data)
 TR-UDP event callback. More...
 

Macro Definition Documentation

#define make_addr (   addr_str,
  port,
  addr,
  addr_len 
)    trudpUdpMakeAddr(addr_str, port, addr, addr_len)

File: tr-udp.h Author: Kirill Scherba kiril.nosp@m.l@sc.nosp@m.herba.nosp@m..ru

Teonet Real time communications over UDP protocol (TR-UDP)

Created on August 4, 2015, 12:16 AM

Examples:
teoackm.c.

Referenced by _cmd_tcpp_read_cb(), event_cb(), ksnCoreSendto(), and teo_recvfrom().

Function Documentation

ssize_t ksnTRUDPrecvfrom ( trudpData *  td,
int  fd,
void *  buffer,
size_t  buffer_len,
int  flags,
__SOCKADDR_ARG  addr,
socklen_t *  addr_len 
)

Get data from peer through TR-UDP transport.

Parameters
td
fd
buffer
buffer_len
flags
addr
addr_len
Returns
If return 0 than the packet is processed by tu->process_packet function. In other case there is value returned by UDP recvfrom function and the buffer contain received data
ssize_t ksnTRUDPsendto ( trudpData *  td,
int  resend_flg,
uint32_t  id,
int  attempt,
int  cmd,
int  fd,
const void *  buf,
size_t  buf_len,
int  flags,
__CONST_SOCKADDR_ARG  addr,
socklen_t  addr_len 
)

Send to peer through TR-UDP transport.

Parameters
tdPointer to trudpData object
resend_flgNew message or resend sent before (0 - new, 1 -resend)
idID of resend message
cmdCommand to allow TR-UDP
attemptNumber of attempt of this message
fdFile descriptor of UDP connection
bufBuffer with data
buf_lenData length
flagsFlags (always 0, reserved)
addrPeer address
addr_lenPeer address length
Returns
Number of bytes sent to UDP

References addr_port::addr, addr_port_free(), CMD_TRUDP_CHECK, DEBUG_VV, DEBUG_VVV, kev, ksn_printf, MODULE, addr_port::port, and wrap_inet_ntop().

Referenced by ksnLNullPacketSend().

void trudp_event_cb ( void *  tcd_pointer,
int  event,
void *  data,
size_t  data_length,
void *  user_data 
)

TR-UDP event callback.

Parameters
tcd_pointer
event
data
data_length
user_data

References _ANSI_NONE, _ANSI_RED, DEBUG_VV, kev, ksn_printf, ksn_puts, ksnCoreProcessPacket(), ksnLNullClientDisconnect(), MODULE, remove_peer_addr(), teo_sendto(), trudp_process_receive(), and trudp_send_event_ack_to_app().

Referenced by ksnCoreInit().