コード例 #1
0
/*----------------------------------------------------------------------
|       PLT_MediaConnect::OnAction
+---------------------------------------------------------------------*/
NPT_Result
PLT_MediaConnect::OnAction(PLT_ActionReference&          action, 
                           const NPT_HttpRequestContext& context)
{
      PLT_MediaConnectInfo* mc_info = NULL;

//    /* get MAC address from IP */
//    if (info != NULL) {
//        NPT_String ip = info->remote_address.GetIpAddress().ToString();
//        NPT_String MAC;
//        GetMACFromIP(ip, MAC);
//
//        if (MAC.GetLength()) {
//            NPT_Result res = m_MediaConnectDeviceInfoMap.Get(MAC, mc_info);
//            if (NPT_FAILED(res)) {
//                m_MediaConnectDeviceInfoMap.Put(MAC, PLT_MediaConnectInfo());
//                m_MediaConnectDeviceInfoMap.Get(MAC, mc_info);
//
//                // automatically validate for now
//                Authorize(mc_info, true);
//            }
//        }
//    }
//
//    /* verify device is allowed first */
//    if (mc_info == NULL || !mc_info->m_Authorized) {
//        action->SetError(801, "Access Denied");
//        return NPT_SUCCESS;
//    }

    /* parse the action name */
    NPT_String name = action->GetActionDesc()->GetName();

    /* handle X_MS_MediaReceiverRegistrar actions here */
    if (name.Compare("IsAuthorized") == 0) {
        return OnIsAuthorized(action, mc_info);
    }
    if (name.Compare("RegisterDevice") == 0) {
        return OnRegisterDevice(action, mc_info);
    }
    if (name.Compare("IsValidated") == 0) {
        return OnIsValidated(action, mc_info);
    }  

    return PLT_FileMediaServer::OnAction(action, context);
}
コード例 #2
0
ファイル: PltMediaConnect.cpp プロジェクト: CEikermann/xbmc
/*----------------------------------------------------------------------
|       PLT_MediaConnect::OnAction
+---------------------------------------------------------------------*/
NPT_Result
PLT_MediaConnect::OnAction(PLT_ActionReference&          action, 
                           
                           const PLT_HttpRequestContext& context)
{
    /* parse the action name */
    NPT_String name = action->GetActionDesc().GetName();

    /* handle X_MS_MediaReceiverRegistrar actions here */
    if (name.Compare("IsAuthorized") == 0) {
        return OnIsAuthorized(action);
    }
    if (name.Compare("RegisterDevice") == 0) {
        return OnRegisterDevice(action);
    }
    if (name.Compare("IsValidated") == 0) {
        return OnIsValidated(action);
    }  

    return PLT_MediaServer::OnAction(action, context);
}