Commit 9ea7f470 authored by George Nash's avatar George Nash

Add context pointer to oc_assert_all_roles

the user_data context pointer is important for
developing language bindings for callback functions.

Rewrote the call to oc_assert_all_roles in oc_tls.c it
passes the oc_tls_peet_t instead of obtaining it inside the
oc_assert_all_roles function. This was the only instance
found that this function was used in the code base.

Change-Id: I5720d95cb0d0027412a14782a1fb7cf336a1444e
Signed-off-by: George Nash's avatarGeorge Nash <george.nash@intel.com>
parent 737cc606
......@@ -702,7 +702,8 @@ oc_assert_role(const char *role, const char *authority, oc_endpoint_t *endpoint,
}
void
oc_assert_all_roles(oc_endpoint_t *endpoint, oc_response_handler_t handler)
oc_assert_all_roles(oc_endpoint_t *endpoint, oc_response_handler_t handler,
void *user_data)
{
oc_tls_peer_t *peer = oc_tls_get_peer(endpoint);
if (oc_tls_uses_psk_cred(peer)) {
......@@ -712,7 +713,7 @@ oc_assert_all_roles(oc_endpoint_t *endpoint, oc_response_handler_t handler)
oc_role_t *roles = oc_get_all_roles();
if (roles) {
if (oc_init_post("/oic/sec/roles", endpoint, NULL, handler, HIGH_QOS,
peer)) {
user_data)) {
oc_rep_start_root_object();
oc_rep_set_array(root, roles);
......
......@@ -426,8 +426,8 @@ bool oc_assert_role(const char *role, const char *authority,
void *user_data);
void oc_auto_assert_roles(bool auto_assert);
void oc_assert_all_roles(oc_endpoint_t *endpoint,
oc_response_handler_t handler);
void oc_assert_all_roles(oc_endpoint_t *endpoint, oc_response_handler_t handler,
void *user_data);
#ifdef OC_TCP
bool oc_send_ping(bool custody, oc_endpoint_t *endpoint,
uint16_t timeout_seconds, oc_response_handler_t handler,
......
......@@ -1653,7 +1653,7 @@ read_application_data(oc_tls_peer_t *peer)
#ifdef OC_PKI
if (auto_assert_all_roles && !oc_tls_uses_psk_cred(peer) &&
oc_get_all_roles()) {
oc_assert_all_roles(&peer->endpoint, assert_all_roles_internal);
oc_assert_all_roles(&peer->endpoint, assert_all_roles_internal, peer);
} else
#endif /* OC_PKI */
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment