WARNING: The online documentation has moved to https://docs.pjsip.org.

Visit the new documentation at https://docs.pjsip.org:

BLOG | DOCUMENTATION | GITHUB

Home --> Documentations --> PJNATH Reference

pj_turn_session_cb Struct Reference
[TURN client session]

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:
sess The TURN session.
peer_addr The peer address.
addr_len Length of the peer address.
ch_num The 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:
sess The TURN session.
pkt The data/payload of the Data Indication or ChannelData packet.
pkt_len Length of the data/payload.
peer_addr Peer address where this payload was received by the TURN server.
addr_len Length 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:
sess The TURN session.
pkt The packet/data to be sent.
pkt_len Length of the packet/data.
dst_addr Destination address of the packet.
addr_len Length of the destination address.
Returns:
The callback should return the status of the send operation.

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:
sess The TURN session.
old_state The previous state of the session.
new_state The 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.