BLOG | DOCUMENTATION | TRAC

Home --> Documentations --> PJNATH Reference

Data Fields

pj_status_t(* on_send_pkt )(pj_turn_session *sess, const pj_uint8_t *pkt, unsigned pkt_len, const pj_sockaddr_t *dst_addr, unsigned addr_len)
 
void(* on_channel_bound )(pj_turn_session *sess, const pj_sockaddr_t *peer_addr, unsigned addr_len, unsigned ch_num)
 
void(* on_rx_data )(pj_turn_session *sess, void *pkt, unsigned pkt_len, const pj_sockaddr_t *peer_addr, unsigned addr_len)
 
void(* on_state )(pj_turn_session *sess, pj_turn_state_t old_state, pj_turn_state_t new_state)
 

Detailed Description

Callback to receive events from TURN session.

Field Documentation

void(* pj_turn_session_cb::on_channel_bound)(pj_turn_session *sess, const pj_sockaddr_t *peer_addr, unsigned addr_len, unsigned ch_num)

Notification when peer address has been bound successfully to a channel number.

This callback is optional since the nature of this callback is for information only.

Parameters
sessThe TURN session.
peer_addrThe peer address.
addr_lenLength of the peer address.
ch_numThe channel number associated with this peer address.
void(* pj_turn_session_cb::on_rx_data)(pj_turn_session *sess, void *pkt, unsigned pkt_len, const pj_sockaddr_t *peer_addr, unsigned addr_len)

Notification when incoming data has been received, either through Data indication or ChannelData message from the TURN server.

Parameters
sessThe TURN session.
pktThe data/payload of the Data Indication or ChannelData packet.
pkt_lenLength of the data/payload.
peer_addrPeer address where this payload was received by the TURN server.
addr_lenLength of the peer address.
pj_status_t(* pj_turn_session_cb::on_send_pkt)(pj_turn_session *sess, const pj_uint8_t *pkt, unsigned pkt_len, const pj_sockaddr_t *dst_addr, unsigned addr_len)

This callback will be called by the TURN session whenever it needs to send outgoing message. Since the TURN session doesn't have a socket on its own, this callback must be implemented.

Parameters
sessThe TURN session.
pktThe packet/data to be sent.
pkt_lenLength of the packet/data.
dst_addrDestination address of the packet.
addr_lenLength of the destination address.
Returns
The callback should return the status of the send operation.
void(* pj_turn_session_cb::on_state)(pj_turn_session *sess, pj_turn_state_t old_state, pj_turn_state_t new_state)

Notification when TURN session state has changed. Application should implement this callback at least to know that the TURN session is going to be destroyed.

Parameters
sessThe TURN session.
old_stateThe previous state of the session.
new_stateThe current state of the session.

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

 


PJNATH - Open Source NAT traversal helper library supporting STUN, TURN, and ICE
Copyright (C) 2006-2009 Teluu Inc.