void ClinkTestcaseHttpRequestRecieved(mUpnpHttpRequest* httpReq) { mUpnpHttpResponse* httpRes; httpRes = mupnp_http_response_new(); mupnp_http_response_setstatuscode(httpRes, MUPNP_HTTP_STATUS_OK); mupnp_http_response_setcontent(httpRes, MUPNP_TESTCASE_HTTP_PAGE); mupnp_http_response_setcontenttype(httpRes, "text/html"); mupnp_http_response_setcontentlength(httpRes, strlen(MUPNP_TESTCASE_HTTP_PAGE)); mupnp_http_request_postresponse(httpReq, httpRes); mupnp_http_response_delete(httpRes); }
void mupnp_event_subscription_subscriberesponse_setresponse(mUpnpSubscriptionResponse* subRes, int code) { char server[MUPNP_SEVERNAME_MAXLEN]; mupnp_log_debug_l4("Entering...\n"); mupnp_http_response_setstatuscode(subRes, code); mupnp_getservername(server, sizeof(server)); mupnp_http_packet_setheadervalue(((mUpnpHttpPacket*)subRes), MUPNP_HTTP_SERVER, server); mupnp_http_response_setcontentlength(subRes, 0); mupnp_log_debug_l4("Leaving...\n"); }
void round_upnp_server_httprequestrecieved(mUpnpHttpRequest* httpReq) { RoundRpcServer* server = round_upnp_server_getrpcserverfromrequest(httpReq); if (server && round_upnp_server_isjsonrpcrequest(httpReq)) { // TODO : Change to post message queue // round_upnp_server_postrpcrequest(NULL, httpReq); server->upnpServer->rpcReqListener(httpReq); return; } else if (round_upnp_server_isrootrequest(httpReq)) { mUpnpHttpResponse* httpRes = mupnp_http_response_new(); mupnp_http_response_setstatuscode(httpRes, MUPNP_HTTP_STATUS_OK); mupnp_http_response_setcontentlength(httpRes, 0); mupnp_http_request_postresponse(httpReq, httpRes); mupnp_http_response_delete(httpRes); return; } mupnp_device_httprequestrecieved(httpReq); }
void upnp_clock_device_httprequestrecieved(mUpnpHttpRequest *httpReq) { mUpnpTime currTime; mUpnpDevice *dev; char *uri; char content[2048]; char sysTimeStr[SYSTEM_TIME_BUF_LEN]; char serverName[MUPNP_SEVERNAME_MAXLEN]; mUpnpHttpResponse *httpRes; BOOL postRet; dev = (mUpnpDevice *)mupnp_http_request_getuserdata(httpReq); uri = mupnp_http_request_geturi(httpReq); if (strcmp(uri, "/presentation") != 0) { mupnp_device_httprequestrecieved(httpReq); return; } currTime = mupnp_getcurrentsystemtime(); #if defined(HAVE_SNPRINTF) snprintf(content, sizeof(content), #else sprintf(content, #endif "<HTML>" "<HEAD>" "<TITLE>UPnP Clock Sample</TITLE>" "</HEAD>" "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"1; URL=/presentation\">" "<BODY><CENTER>" "<H1>UPnP Clock Sample</H1>" "<TABLE border=\"0\" cellpadding=\"0\" cellspacing=\"0\">" "<TR>" "<TD style=\"width: 50px; height: 50px; background-color: rgb(176, 176, 176);\"></TD>" "<TD style=\"background-color: rgb(176, 176, 176);\"></TD>" "<TD style=\"width: 50px; height: 50px; background-color: rgb(176, 176, 176);\"></TD>" "</TR>" "<TR>" "<TD style=\"height: 50px; background-color: rgb(176, 176, 176);\"></TD>" "<TD style=\"height: 50px; background-color: rgb(221, 236, 245);\" align=\"center\"><H1>" "%s" "</H1></TD>" "<TD style=\"height: 50px; background-color: rgb(176, 176, 176);\"></TD>" "</TR>" "<TR>" "<TD style=\"height: 50px; background-color: rgb(176, 176, 176);\"></TD>" "<TD style=\"height: 50px; background-color: rgb(221, 236, 245);\" align=\"center\"><H3>" "Server : %s" "</H3></TD>" "<TD style=\"height: 30px; background-color: rgb(176, 176, 176);\"></TD>" "</TR>" "<TR>" "<TD style=\"width: 30px; height: 50px; background-color: rgb(176, 176, 176);\"></TD>" "<TD style=\"background-color: rgb(176, 176, 176);\"></TD>" "<TD style=\"width: 30px; height: 50px; background-color: rgb(176, 176, 176);\"></TD>" "</TR>" "</TABLE>" "<CENTER></BODY>" "</HTML>", GetSystemTimeString(currTime, sysTimeStr), mupnp_getservername(serverName, sizeof(serverName))); httpRes = mupnp_http_response_new(); mupnp_http_response_setstatuscode(httpRes, CG_HTTP_STATUS_OK); mupnp_http_response_setcontent(httpRes, content); mupnp_http_response_setcontenttype(httpRes, "text/html"); mupnp_http_response_setcontentlength(httpRes, strlen(content)); postRet = mupnp_http_request_postresponse(httpReq, httpRes); mupnp_http_response_delete(httpRes); }