Home --> Documentations --> PJNATH Reference
#include <turn_sock.h>
|
void(* | on_rx_data )(pj_turn_sock *turn_sock, void *pkt, unsigned pkt_len, const pj_sockaddr_t *peer_addr, unsigned addr_len) |
|
pj_bool_t(* | on_data_sent )(pj_turn_sock *sock, pj_ssize_t sent) |
|
void(* | on_state )(pj_turn_sock *turn_sock, pj_turn_state_t old_state, pj_turn_state_t new_state) |
|
pj_status_t(* | on_connection_attempt )(pj_turn_sock *turn_sock, pj_uint32_t conn_id, const pj_sockaddr_t *peer_addr, unsigned addr_len) |
|
void(* | on_connection_status )(pj_turn_sock *turn_sock, pj_status_t status, pj_uint32_t conn_id, const pj_sockaddr_t *peer_addr, unsigned addr_len) |
|
This structure contains callbacks that will be called by the TURN transport.
◆ 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 should implement this callback if it uses RFC 6062 (TURN TCP allocations), otherwise TURN client will automatically accept it.
If application accepts the peer connection attempt (i.e: by returning PJ_SUCCESS or not implementing this callback), the TURN socket will initiate a new connection to the TURN server and send ConnectionBind request, and eventually will notify application via on_connection_status callback, if implemented.
- Parameters
-
turn_sock | The TURN client transport. |
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. |
- Returns
- The callback must return PJ_SUCCESS to accept the connection attempt.
◆ on_connection_status
Notification for initiated TCP data connection to peer (RFC 6062), for example after peer connection attempt is accepted.
- Parameters
-
turn_sock | The TURN client transport. |
status | The status code. |
conn_id | The connection ID. |
peer_addr | Peer address. |
addr_len | Length of the peer address. |
◆ on_data_sent
Notifification when asynchronous send operation has completed.
- Parameters
-
turn_sock | The TURN transport. |
sent | If value is positive non-zero it indicates the number of data sent. When the value is negative, it contains the error code which can be retrieved by negating the value (i.e. status=-sent). |
- Returns
- Application should normally return PJ_TRUE to let the TURN transport continue its operation. However it must return PJ_FALSE if it has destroyed the TURN transport in this callback.
◆ on_rx_data
void(* pj_turn_sock_cb::on_rx_data) (pj_turn_sock *turn_sock, void *pkt, unsigned pkt_len, const pj_sockaddr_t *peer_addr, unsigned addr_len) |
Notification when incoming data has been received from the remote peer via the TURN server. The data reported in this callback will be the exact data as sent by the peer (e.g. the TURN encapsulation such as Data Indication or ChannelData will be removed before this function is called).
- Parameters
-
turn_sock | The TURN client transport. |
data | The data as received from the peer.
|
data_len | Length of the data. |
peer_addr | The peer address. |
addr_len | The length of the peer address. |
◆ on_state
Notification when TURN session state has changed. Application should implement this callback to monitor the progress of the TURN session.
- Parameters
-
turn_sock | The TURN client transport. |
old_state | Previous state. |
new_state | Current state. |
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.
|