Home --> Documentations --> PJLIB Reference
#include <ssl_sock.h>
|
pj_bool_t(* | on_data_read )(pj_ssl_sock_t *ssock, void *data, pj_size_t size, pj_status_t status, pj_size_t *remainder) |
|
pj_bool_t(* | on_data_recvfrom )(pj_ssl_sock_t *ssock, void *data, pj_size_t size, const pj_sockaddr_t *src_addr, int addr_len, pj_status_t status) |
|
pj_bool_t(* | on_data_sent )(pj_ssl_sock_t *ssock, pj_ioqueue_op_key_t *send_key, pj_ssize_t sent) |
|
pj_bool_t(* | on_accept_complete )(pj_ssl_sock_t *ssock, pj_ssl_sock_t *newsock, const pj_sockaddr_t *src_addr, int src_addr_len) |
|
pj_bool_t(* | on_accept_complete2 )(pj_ssl_sock_t *ssock, pj_ssl_sock_t *newsock, const pj_sockaddr_t *src_addr, int src_addr_len, pj_status_t status) |
|
pj_bool_t(* | on_connect_complete )(pj_ssl_sock_t *ssock, pj_status_t status) |
|
pj_bool_t(* | on_verify_cb )(pj_ssl_sock_t *ssock, pj_bool_t is_server) |
|
This structure contains the callbacks to be called by the secure socket.
◆ on_accept_complete
This callback is called when new connection arrives as the result of pj_ssl_sock_start_accept(). If the status of accept operation is needed use on_accept_complete2 instead of this callback.
- Parameters
-
ssock | The secure socket. |
newsock | The new incoming secure socket. |
src_addr | The source address of the connection. |
addr_len | Length of the source address. |
- Returns
- PJ_TRUE if further accept() is desired, and PJ_FALSE when application no longer wants to accept incoming connection. Application may destroy the secure socket in the callback and return PJ_FALSE here.
◆ on_accept_complete2
This callback is called when new connection arrives as the result of pj_ssl_sock_start_accept().
- Parameters
-
asock | The active socket. |
newsock | The new incoming socket. |
src_addr | The source address of the connection. |
addr_len | Length of the source address. |
status | The status of the accept operation. This may contain non-PJ_SUCCESS for example when the TCP listener is in bad state for example on iOS platform after the application waking up from background. |
- Returns
- PJ_TRUE if further accept() is desired, and PJ_FALSE when application no longer wants to accept incoming connection. Application may destroy the active socket in the callback and return PJ_FALSE here.
◆ on_connect_complete
This callback is called when pending connect operation has been completed.
- Parameters
-
ssock | The secure socket. |
status | The connection result. If connection has been successfully established, the status will contain PJ_SUCCESS. |
- Returns
- Application may destroy the secure socket in the callback and return PJ_FALSE here.
◆ on_data_read
This callback is called when a data arrives as the result of pj_ssl_sock_start_read().
- Parameters
-
ssock | The secure socket. |
data | The buffer containing the new data, if any. If the status argument is non-PJ_SUCCESS, this argument may be NULL. |
size | The length of data in the buffer. |
status | The status of the read operation. This may contain non-PJ_SUCCESS for example when the TCP connection has been closed. In this case, the buffer may contain left over data from previous callback which the application may want to process. |
remainder | If application wishes to leave some data in the buffer (common for TCP applications), it should move the remainder data to the front part of the buffer and set the remainder length here. The value of this parameter will be ignored for datagram sockets. |
- Returns
- PJ_TRUE if further read is desired, and PJ_FALSE when application no longer wants to receive data. Application may destroy the secure socket in the callback and return PJ_FALSE here.
◆ on_data_recvfrom
This callback is called when a packet arrives as the result of pj_ssl_sock_start_recvfrom().
- Parameters
-
ssock | The secure socket. |
data | The buffer containing the packet, if any. If the status argument is non-PJ_SUCCESS, this argument will be set to NULL. |
size | The length of packet in the buffer. If the status argument is non-PJ_SUCCESS, this argument will be set to zero. |
src_addr | Source address of the packet. |
addr_len | Length of the source address. |
status | This contains |
- Returns
- PJ_TRUE if further read is desired, and PJ_FALSE when application no longer wants to receive data. Application may destroy the secure socket in the callback and return PJ_FALSE here.
◆ on_data_sent
This callback is called when data has been sent.
- Parameters
-
ssock | The secure socket. |
send_key | Key associated with the send operation. |
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 may destroy the secure socket in the callback and return PJ_FALSE here.
◆ on_verify_cb
This callback is called when certificate verification is being done. Certification info can be obtained from pj_ssl_sock_info. Currently it's only implemented for OpenSSL backend.
- Parameters
-
ssock | The secure socket. |
is_server | PJ_TRUE to indicate an incoming connection. |
- Returns
- Return PJ_TRUE if verification is successful. If verification failed, then the connection will be dropped immediately.
The documentation for this struct was generated from the following file:
PJLIB Open Source, high performance, small footprint, and very very portable framework
Copyright (C) 2006-2009 Teluu Inc.
|