static int __app_control_launch(iotcon_request_h request, iotcon_attributes_h attributes)
{
+ char *hostAddress;
+ int ret = iotcon_request_get_host_address(request, &hostAddress);
+ IF_FAIL_RETURN_TAG(ret == IOTCON_ERROR_NONE, CONV_ERROR_INVALID_PARAMETER, _E, "iotcon_request_get_host_address() Fail(%d)", ret);
+ string hostAddressString(hostAddress);
+ string ip = conv::util::getIpAddress(hostAddressString);
+
+ char macAddress[127] = {0,};
+
+ IF_FAIL_RETURN_TAG(conv::util::getPeerMac(ip, -1, macAddress), CONV_ERROR_INVALID_PARAMETER, _E, "getPeerMac failed");
+
+ _D("Device IP : %s, Mac : %s", ip.c_str(), macAddress);
+ ACManagerPolicy acManagerPolicy = ACMANAGER_POLICY_U;
+
+ IF_FAIL_RETURN_TAG(GetACLState(macAddress, &acManagerPolicy) == ACLResult_OK, CONV_ERROR_INVALID_OPERATION, _E, "ACL check failed");
+ if (acManagerPolicy == ACMANAGER_POLICY_P) {
+ _D("PERMITTED");
+ } else {
+ _D("Device is not permitted %d", acManagerPolicy);
+ return CONV_ERROR_INVALID_OPERATION;
+ }
+
app_control_h app_control;
int reply = 0;
char *appctl_char;
-// Check if it's permitted device
-#if defined(_TV_)
- _D("TV:Always PERMITTED");
-#else
- _D("Always PERMITTED");
-#endif
-
- int ret = iotcon_attributes_get_str(attributes, CONV_JSON_APP_CONTROL, &appctl_char);
+ ret = iotcon_attributes_get_str(attributes, CONV_JSON_APP_CONTROL, &appctl_char);
IF_FAIL_RETURN_TAG(ret == IOTCON_ERROR_NONE, CONV_ERROR_INVALID_PARAMETER, _E, "iotcon_attributes_get_str() Fail(%d)", ret);
bundle_raw* encoded = reinterpret_cast<unsigned char*>(appctl_char);