Home --> Documentations --> PJNATH Reference
#include <stun_session.h>
|
pj_status_t(* | on_send_msg )(pj_stun_session *sess, void *token, const void *pkt, pj_size_t pkt_size, const pj_sockaddr_t *dst_addr, unsigned addr_len) |
|
pj_status_t(* | on_rx_request )(pj_stun_session *sess, const pj_uint8_t *pkt, unsigned pkt_len, const pj_stun_rx_data *rdata, void *token, const pj_sockaddr_t *src_addr, unsigned src_addr_len) |
|
void(* | on_request_complete )(pj_stun_session *sess, pj_status_t status, void *token, pj_stun_tx_data *tdata, const pj_stun_msg *response, const pj_sockaddr_t *src_addr, unsigned src_addr_len) |
|
pj_status_t(* | on_rx_indication )(pj_stun_session *sess, const pj_uint8_t *pkt, unsigned pkt_len, const pj_stun_msg *msg, void *token, const pj_sockaddr_t *src_addr, unsigned src_addr_len) |
|
This is the callback to be registered to pj_stun_session, to send outgoing message and to receive various notifications from the STUN session.
◆ on_request_complete
Callback to be called when response is received or the transaction has timed out. This callback is called either when application calls pj_stun_session_on_rx_pkt() with the packet containing a STUN response for the client transaction, or when the internal timer of the STUN client transaction has timed-out before a STUN response is received.
- Parameters
-
sess | The STUN session. |
status | Status of the request. If the value if not PJ_SUCCESS, the transaction has timed-out or other error has occurred, and the response argument may be NULL. Note that when the status is not success, the response may contain non-NULL value if the response contains STUN ERROR-CODE attribute. |
token | The token that was set by the application when calling pj_stun_session_send_msg() function. Please not that this token IS NOT the token that was given in pj_stun_session_on_rx_pkt(). |
tdata | The original STUN request. |
response | The response message, on successful transaction, or otherwise MAY BE NULL if status is not success. Note that when the status is not success, this argument may contain non-NULL value if the response contains STUN ERROR-CODE attribute. |
src_addr | The source address where the response was received, or NULL if the response is NULL. |
src_addr_len | The length of the source address. |
◆ on_rx_indication
Callback to be called on incoming STUN request message. This function is called when application calls pj_stun_session_on_rx_pkt() and when the STUN session has detected that the incoming STUN message is a STUN indication message.
- Parameters
-
sess | The STUN session. |
pkt | Pointer to the original STUN packet. |
pkt_len | Length of the STUN packet. |
msg | The parsed STUN indication. |
token | The token that was set by the application when calling pj_stun_session_on_rx_pkt() function. |
src_addr | Source address of the packet. |
src_addr_len | Length of the source address. |
- Returns
- The return value of this callback will be returned back to pj_stun_session_on_rx_pkt() function.
◆ on_rx_request
Callback to be called on incoming STUN request message. This function is called when application calls pj_stun_session_on_rx_pkt() and when the STUN session has detected that the incoming STUN message is a STUN request message. In the callback processing, application MUST create a response by calling pj_stun_session_create_response() function and send the response with pj_stun_session_send_msg() function, before returning from the callback.
- Parameters
-
sess | The STUN session. |
pkt | Pointer to the original STUN packet. |
pkt_len | Length of the STUN packet. |
rdata | Data containing incoming request message. |
token | The token that was set by the application when calling pj_stun_session_on_rx_pkt() function. |
src_addr | Source address of the packet. |
src_addr_len | Length of the source address. |
- Returns
- The return value of this callback will be returned back to pj_stun_session_on_rx_pkt() function.
◆ on_send_msg
Callback to be called by the STUN session to send outgoing message.
- Parameters
-
sess | The STUN session. |
token | The token associated with this outgoing message and was set by the application. This token was set by application in pj_stun_session_send_msg() for outgoing messages that are initiated by the application, or in pj_stun_session_on_rx_pkt() if this message is a response that was internally generated by the STUN session (for example, an 401/Unauthorized response). Application may use this facility for any purposes. |
pkt | Packet to be sent. |
pkt_size | Size of the packet to be sent. |
dst_addr | The destination address. |
addr_len | Length of destination address. |
- Returns
- The callback should return the status of the packet sending.
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.
|