Home --> Documentations --> PJNATH Reference
#include <turn_session.h>
|
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) |
|
pj_status_t(* | on_stun_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) |
|
void(* | on_connection_attempt )(pj_turn_session *sess, pj_uint32_t conn_id, const pj_sockaddr_t *peer_addr, unsigned addr_len) |
|
void(* | on_connection_bind_status )(pj_turn_session *sess, pj_status_t status, pj_uint32_t conn_id, const pj_sockaddr_t *peer_addr, unsigned addr_len) |
|
void(* | on_connect_complete )(pj_turn_session *sess, pj_status_t status, pj_uint32_t conn_id, const pj_sockaddr_t *peer_addr, unsigned addr_len) |
|
Callback to receive events from TURN session.
◆ on_channel_bound
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. |
◆ on_connect_complete
Notification for Connect request sent using pj_turn_session_connect().
- Parameters
-
sess | The TURN session. |
status | The status code. |
conn_id | The connection ID. |
peer_addr | Peer address. |
addr_len | Length of the peer address. |
◆ on_connection_attempt
Notification when TURN client received a ConnectionAttempt Indication from the TURN server, which indicates that peer initiates a TCP connection to allocated slot in the TURN server. Application must implement this callback if it uses RFC 6062 (TURN TCP allocations).
After receiving this callback, application should establish a new TCP connection to the TURN server and send ConnectionBind request (using pj_turn_session_connection_bind()). After the connection binding succeeds, this new connection will become a data only connection.
- Parameters
-
sess | The TURN session. |
conn_id | The connection ID assigned by TURN server. |
peer_addr | Peer address that tried to connect to the TURN server. |
addr_len | Length of the peer address. |
◆ on_connection_bind_status
Notification for ConnectionBind request sent using pj_turn_session_connection_bind().
- Parameters
-
sess | The TURN session. |
status | The status code. |
conn_id | The connection ID. |
peer_addr | Peer address. |
addr_len | Length of the peer address. |
◆ on_rx_data
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. |
◆ on_send_pkt
This callback will be called by the TURN session whenever it needs to send data or outgoing messages. Since the TURN session doesn't have a socket on its own, this callback must be implemented.
If the callback on_stun_send_pkt() is implemented, outgoing messages will use that callback instead.
- 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.
◆ on_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
-
sess | The TURN session. |
old_state | The previous state of the session. |
new_state | The current state of the session. |
◆ on_stun_send_pkt
This callback will be called by the TURN session whenever it needs to send outgoing STUN requests/messages for TURN signalling purposes (data sending will not invoke this callback). If this callback is not implemented, the callback on_send_pkt() will be called instead.
- 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.
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.
|