示例#1
0
bool cSatipRtsp::ValidateLatestResponse(long *rcP)
{
  bool result = false;

  if (handleM) {
     char *url = NULL;
     long rc = 0;
     CURLcode res = CURLE_OK;
     SATIP_CURL_EASY_GETINFO(handleM, CURLINFO_RESPONSE_CODE, &rc);
     switch (rc) {
       case 200:
            result = true;
            break;
       case 400:
            // SETUP PLAY TEARDOWN
            // The message body of the response may contain the "Check-Syntax:" parameter followed
            // by the malformed syntax
            if (!isempty(*errorCheckSyntaxM)) {
               SATIP_CURL_EASY_GETINFO(handleM, CURLINFO_EFFECTIVE_URL, &url);
               error("Check syntax: %s (error code %ld: %s) [device %d]", *errorCheckSyntaxM, rc, url, tunerM.GetId());
               break;
               }
       case 403:
            // SETUP PLAY TEARDOWN
            // The message body of the response may contain the "Out-of-Range:" parameter followed
            // by a space-separated list of the attribute names that are not understood:
            // "src" "fe" "freq" "pol" "msys" "mtype" "plts" "ro" "sr" "fec" "pids" "addpids" "delpids" "mcast
            if (!isempty(*errorOutOfRangeM)) {
               SATIP_CURL_EASY_GETINFO(handleM, CURLINFO_EFFECTIVE_URL, &url);
               error("Out of range: %s (error code %ld: %s) [device %d]", *errorOutOfRangeM, rc, url, tunerM.GetId());
               break;
               }
       case 503:
            // SETUP PLAY
            // The message body of the response may contain the "No-More:" parameter followed
            // by a space-separated list of the missing ressources: “sessions” "frontends" "pids
            if (!isempty(*errorNoMoreM)) {
               SATIP_CURL_EASY_GETINFO(handleM, CURLINFO_EFFECTIVE_URL, &url);
               error("No more: %s (error code %ld: %s) [device %d]", *errorNoMoreM, rc, url, tunerM.GetId());
               break;
               }
       default:
            SATIP_CURL_EASY_GETINFO(handleM, CURLINFO_EFFECTIVE_URL, &url);
            error("Detected invalid status code %ld: %s [device %d]", rc, url, tunerM.GetId());
            break;
       }
     if (rcP)
        *rcP = rc;
     }
  errorNoMoreM = "";
  errorOutOfRangeM = "";
  errorCheckSyntaxM = "";
  debug1("%s result=%s [device %d]", __PRETTY_FUNCTION__, result ? "ok" : "failed", tunerM.GetId());

  return result;
}
示例#2
0
bool cSatipRtsp::ValidateLatestResponse(long *rcP)
{
  bool result = false;

  if (handleM) {
     long rc = 0;
     CURLcode res = CURLE_OK;
     SATIP_CURL_EASY_GETINFO(handleM, CURLINFO_RESPONSE_CODE, &rc);
     if (rc == 200)
        result = true;
     else if (rc != 0) {
        char *url = NULL;
        SATIP_CURL_EASY_GETINFO(handleM, CURLINFO_EFFECTIVE_URL, &url);
        error("Detected invalid status code %ld: %s [device %d]", rc, url, tunerM.GetId());
        }
     if (rcP)
        *rcP = rc;
     }
  debug1("%s result=%s [device %d]", __PRETTY_FUNCTION__, result ? "ok" : "failed", tunerM.GetId());

  return result;
}