cleanup: Declare some unshared functions static.
This commit is contained in:
parent
c1bb37a387
commit
13d36533b5
@ -307,7 +307,7 @@ SendSSDPNotifies(int s, const char *host, unsigned short port,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
ParseUPnPClient(char *location)
|
ParseUPnPClient(char *location)
|
||||||
{
|
{
|
||||||
char buf[8192];
|
char buf[8192];
|
||||||
|
@ -176,7 +176,7 @@ sendBeaconMessage(int fd, struct sockaddr_in * client, int len, int broadcast)
|
|||||||
*
|
*
|
||||||
* Returns true if this was a broadcast beacon msg
|
* Returns true if this was a broadcast beacon msg
|
||||||
*/
|
*/
|
||||||
int
|
static int
|
||||||
rcvBeaconMessage(char *beacon)
|
rcvBeaconMessage(char *beacon)
|
||||||
{
|
{
|
||||||
char *tivoConnect = NULL;
|
char *tivoConnect = NULL;
|
||||||
|
@ -123,7 +123,7 @@ seedRandomByte(uint32_t seed)
|
|||||||
return sqlite3Prng.s[t];
|
return sqlite3Prng.s[t];
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
seedRandomness(int n, void *pbuf, uint32_t seed)
|
seedRandomness(int n, void *pbuf, uint32_t seed)
|
||||||
{
|
{
|
||||||
unsigned char *zbuf = pbuf;
|
unsigned char *zbuf = pbuf;
|
||||||
|
102
upnpsoap.c
102
upnpsoap.c
@ -78,6 +78,55 @@
|
|||||||
# define __SORT_LIMIT
|
# define __SORT_LIMIT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Standard Errors:
|
||||||
|
*
|
||||||
|
* errorCode errorDescription Description
|
||||||
|
* -------- ---------------- -----------
|
||||||
|
* 401 Invalid Action No action by that name at this service.
|
||||||
|
* 402 Invalid Args Could be any of the following: not enough in args,
|
||||||
|
* too many in args, no in arg by that name,
|
||||||
|
* one or more in args are of the wrong data type.
|
||||||
|
* 403 Out of Sync Out of synchronization.
|
||||||
|
* 501 Action Failed May be returned in current state of service
|
||||||
|
* prevents invoking that action.
|
||||||
|
* 600-699 TBD Common action errors. Defined by UPnP Forum
|
||||||
|
* Technical Committee.
|
||||||
|
* 700-799 TBD Action-specific errors for standard actions.
|
||||||
|
* Defined by UPnP Forum working committee.
|
||||||
|
* 800-899 TBD Action-specific errors for non-standard actions.
|
||||||
|
* Defined by UPnP vendor.
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
SoapError(struct upnphttp * h, int errCode, const char * errDesc)
|
||||||
|
{
|
||||||
|
static const char resp[] =
|
||||||
|
"<s:Envelope "
|
||||||
|
"xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\" "
|
||||||
|
"s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">"
|
||||||
|
"<s:Body>"
|
||||||
|
"<s:Fault>"
|
||||||
|
"<faultcode>s:Client</faultcode>"
|
||||||
|
"<faultstring>UPnPError</faultstring>"
|
||||||
|
"<detail>"
|
||||||
|
"<UPnPError xmlns=\"urn:schemas-upnp-org:control-1-0\">"
|
||||||
|
"<errorCode>%d</errorCode>"
|
||||||
|
"<errorDescription>%s</errorDescription>"
|
||||||
|
"</UPnPError>"
|
||||||
|
"</detail>"
|
||||||
|
"</s:Fault>"
|
||||||
|
"</s:Body>"
|
||||||
|
"</s:Envelope>";
|
||||||
|
|
||||||
|
char body[2048];
|
||||||
|
int bodylen;
|
||||||
|
|
||||||
|
DPRINTF(E_WARN, L_HTTP, "Returning UPnPError %d: %s\n", errCode, errDesc);
|
||||||
|
bodylen = snprintf(body, sizeof(body), resp, errCode, errDesc);
|
||||||
|
BuildResp2_upnphttp(h, 500, "Internal Server Error", body, bodylen);
|
||||||
|
SendResp_upnphttp(h);
|
||||||
|
CloseSocket_upnphttp(h);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
BuildSendAndCloseSoapResp(struct upnphttp * h,
|
BuildSendAndCloseSoapResp(struct upnphttp * h,
|
||||||
const char * body, int bodylen)
|
const char * body, int bodylen)
|
||||||
@ -515,7 +564,7 @@ set_filter_flags(char *filter, struct upnphttp *h)
|
|||||||
return flags;
|
return flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
static char *
|
||||||
parse_sort_criteria(char *sortCriteria, int *error)
|
parse_sort_criteria(char *sortCriteria, int *error)
|
||||||
{
|
{
|
||||||
char *order = NULL;
|
char *order = NULL;
|
||||||
@ -1337,7 +1386,7 @@ browse_error:
|
|||||||
free(str.data);
|
free(str.data);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void
|
static inline void
|
||||||
charcat(struct string_s *str, char c)
|
charcat(struct string_s *str, char c)
|
||||||
{
|
{
|
||||||
if (str->size <= str->off)
|
if (str->size <= str->off)
|
||||||
@ -1945,52 +1994,3 @@ ExecuteSoapAction(struct upnphttp * h, const char * action, int n)
|
|||||||
SoapError(h, 401, "Invalid Action");
|
SoapError(h, 401, "Invalid Action");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Standard Errors:
|
|
||||||
*
|
|
||||||
* errorCode errorDescription Description
|
|
||||||
* -------- ---------------- -----------
|
|
||||||
* 401 Invalid Action No action by that name at this service.
|
|
||||||
* 402 Invalid Args Could be any of the following: not enough in args,
|
|
||||||
* too many in args, no in arg by that name,
|
|
||||||
* one or more in args are of the wrong data type.
|
|
||||||
* 403 Out of Sync Out of synchronization.
|
|
||||||
* 501 Action Failed May be returned in current state of service
|
|
||||||
* prevents invoking that action.
|
|
||||||
* 600-699 TBD Common action errors. Defined by UPnP Forum
|
|
||||||
* Technical Committee.
|
|
||||||
* 700-799 TBD Action-specific errors for standard actions.
|
|
||||||
* Defined by UPnP Forum working committee.
|
|
||||||
* 800-899 TBD Action-specific errors for non-standard actions.
|
|
||||||
* Defined by UPnP vendor.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
SoapError(struct upnphttp * h, int errCode, const char * errDesc)
|
|
||||||
{
|
|
||||||
static const char resp[] =
|
|
||||||
"<s:Envelope "
|
|
||||||
"xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\" "
|
|
||||||
"s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">"
|
|
||||||
"<s:Body>"
|
|
||||||
"<s:Fault>"
|
|
||||||
"<faultcode>s:Client</faultcode>"
|
|
||||||
"<faultstring>UPnPError</faultstring>"
|
|
||||||
"<detail>"
|
|
||||||
"<UPnPError xmlns=\"urn:schemas-upnp-org:control-1-0\">"
|
|
||||||
"<errorCode>%d</errorCode>"
|
|
||||||
"<errorDescription>%s</errorDescription>"
|
|
||||||
"</UPnPError>"
|
|
||||||
"</detail>"
|
|
||||||
"</s:Fault>"
|
|
||||||
"</s:Body>"
|
|
||||||
"</s:Envelope>";
|
|
||||||
|
|
||||||
char body[2048];
|
|
||||||
int bodylen;
|
|
||||||
|
|
||||||
DPRINTF(E_WARN, L_HTTP, "Returning UPnPError %d: %s\n", errCode, errDesc);
|
|
||||||
bodylen = snprintf(body, sizeof(body), resp, errCode, errDesc);
|
|
||||||
BuildResp2_upnphttp(h, 500, "Internal Server Error", body, bodylen);
|
|
||||||
SendResp_upnphttp(h);
|
|
||||||
CloseSocket_upnphttp(h);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@ -50,11 +50,5 @@ struct Response
|
|||||||
void
|
void
|
||||||
ExecuteSoapAction(struct upnphttp *, const char *, int);
|
ExecuteSoapAction(struct upnphttp *, const char *, int);
|
||||||
|
|
||||||
/* SoapError():
|
|
||||||
* sends a correct SOAP error with an UPNPError code and
|
|
||||||
* description */
|
|
||||||
void
|
|
||||||
SoapError(struct upnphttp * h, int errCode, const char * errDesc);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user