42#include <upnptools.hpp>
125 return "Unknown error code";
137 char* tempRel = NULL;
145 strcpy(AbsURL, tempRel);
183 const char* ActionName,
185 const char* ServType,
189 const char* ArgValue) {
190 char* ActBuff = NULL;
196 if (ActionName == NULL || ServType == NULL) {
200 if (*ActionDoc == NULL) {
202 if (ActBuff == NULL) {
209 "xmlns:u=\"%s\">\r\n</u:%sResponse>",
210 ActionName, ServType, ActionName);
213 "<u:%s xmlns:u=\"%s\">\r\n</u:%s>", ActionName,
214 ServType, ActionName);
223 if (
rc != IXML_SUCCESS) {
224 if (
rc == IXML_INSUFFICIENT_MEMORY) {
232 if (ArgName != NULL ) {
255 const char* ActionName,
257 const char* ServType,
265 const char* ArgValue;
274 if (ActionName == NULL || ServType == NULL) {
279 if (ActBuff == NULL) {
285 "<u:%sResponse xmlns:u=\"%s\">\r\n</u:%sResponse>",
286 ActionName, ServType, ActionName);
289 snprintf(ActBuff,
HEADER_LENGTH,
"<u:%s xmlns:u=\"%s\">\r\n</u:%s>",
290 ActionName, ServType, ActionName);
299 if (ActionDoc == NULL) {
307 ArgValue = va_arg(ArgList,
const char*);
308 if (ArgName != NULL) {
317 if (++Idx < NumArg) {
318 ArgName = va_arg(ArgList,
const char*);
330 int NumArg,
const char* Arg, ...) {
334 va_start(ArgList, Arg);
335 out =
makeAction(0, ActionName, ServType, NumArg, Arg, ArgList);
342 const char* ServType,
int NumArg,
343 const char* Arg, ...) {
347 va_start(ArgList, Arg);
348 out =
makeAction(1, ActionName, ServType, NumArg, Arg, ArgList);
355 const char* ServType,
const char* ArgName,
356 const char* ArgValue) {
357 return addToAction(0, ActionDoc, ActionName, ServType, ArgName, ArgValue);
361 const char* ActionName,
const char* ServType,
362 const char* ArgName,
const char* ArgValue) {
363 return addToAction(1, ActionResponse, ActionName, ServType, ArgName,
371 "<e:propertyset xmlns:e=\"urn:schemas-upnp-org:event-1-0\">"
373 const char *ArgName, *ArgValue;
388 va_start(ArgList, Arg);
390 while (Idx++ != NumArg) {
391 ArgValue = va_arg(ArgList,
const char*);
392 if (ArgName != NULL ) {
403 ArgName = va_arg(ArgList,
const char*);
411 const char* ArgValue) {
413 "<e:propertyset xmlns:e=\"urn:schemas-upnp-org:event-1-0\">"
421 if (ArgName == NULL) {
425 if (*PropSet == NULL) {
427 if (
rc != IXML_SUCCESS) {
#define UPNP_E_INVALID_DEVICE
The operation completed successfully.
#define UPNP_E_FILE_WRITE_ERROR
The operation completed successfully.
#define UPNP_E_INVALID_SID
The operation completed successfully.
#define UPNP_E_NO_WEB_SERVER
The operation completed successfully.
#define UPNP_E_BAD_REQUEST
The operation completed successfully.
#define UPNP_E_OUTOF_BOUNDS
The operation completed successfully.
#define UPNP_E_OUTOF_CONTEXT
The operation completed successfully.
#define UPNP_E_EVENT_PROTOCOL
The operation completed successfully.
#define UPNP_E_BUFFER_TOO_SMALL
The operation completed successfully.
void TPSetMaxJobsTotal(int mjt)
Sets the maximum number of jobs in the thread pool.
Manage a threadpool (for internal use only).
Data structure common to all types of nodes.
Data structure representing an Element node.
Data structure representing the DOM Document.
PUPNP_Api int ixmlNode_appendChild(IXML_Node *nodeptr, IXML_Node *newChild)
Appends a child Node to the list of children of a Node.
PUPNP_Api int ixmlParseBufferEx(const char *buffer, IXML_Document **doc)
Parses an XML text buffer converting it into an IXML DOM representation.
PUPNP_Api IXML_Element * ixmlDocument_createElement(IXML_Document *doc, const DOMString tagName)
Creates a new Element node with the given tag name.
PUPNP_Api IXML_Node * ixmlDocument_createTextNode(IXML_Document *doc, const DOMString data)
Creates a new Text node with the given data.
PUPNP_Api IXML_Node * ixmlNode_getFirstChild(IXML_Node *nodeptr)
Retrieves the first child Node of a Node.
#define UPNP_E_SOCKET_CONNECT
The SDK had a problem connecting to a remote host.
#define UPNP_E_OUTOF_HANDLE
The SDK does not have any more space for additional handles.
#define UPNP_E_ALREADY_REGISTERED
A client or a device is already registered.
#define UPNP_E_NOT_FOUND
The response to a SOAP request did not contain the required XML constructs.
#define UPNP_E_SOCKET_ERROR
Generic socket error code for conditions not covered by other error codes.
#define UPNP_E_LISTEN
The SDK had a problem setting the socket to listen for incoming connections.
#define UPNP_E_NETWORK_ERROR
A network error occurred.
#define UPNP_E_SOCKET_BIND
The SDK had a problem binding a socket to a network interface.
#define UPNP_E_INVALID_ARGUMENT
One or more of the parameters passed to a function is invalid.
#define UPNP_E_INVALID_HANDLE
The handle passed to a function is not a recognized as a valid handle.
#define UPNP_E_TIMEDOUT
Too much time elapsed before the required number of bytes were sent or received over a socket.
#define UPNP_E_FILE_READ_ERROR
An error happened while reading a file.
#define UPNP_E_INVALID_INTERFACE
The interface provided to UpnpInit2 is unknown or does not have a valid IPv4 or IPv6 address configur...
#define UPNP_E_BAD_HTTPMSG
The HTTP message contains invalid message headers.
#define UPNP_E_FILE_NOT_FOUND
The filename passed to one of the device registration functions was not found or was not accessible.
#define UPNP_E_SUCCESS
The operation completed successfully.
#define UPNP_E_SUBSCRIBE_UNACCEPTED
A subscription request was rejected from the remote side.
#define UPNP_E_OUTOF_SOCKET
The SDK cannot create any more sockets.
#define UPNP_E_OUTOF_MEMORY
Not enough resources are currently available to complete the operation.
#define UPNP_E_INVALID_URL
An URL passed into the function is invalid.
#define UPNP_E_INVALID_ACTION
The SOAP action message is invalid.
#define UPNP_E_SOCKET_WRITE
An error happened while writing to a socket.
#define UPNP_E_FINISH
UpnpInit2 has not been called, or UpnpFinish has already been called.
#define UPNP_E_INIT_FAILED
UpnpInit2 cannot complete.
#define UPNP_E_UNSUBSCRIBE_UNACCEPTED
An unsubscribe request was rejected from the remote side.
#define UPNP_E_NOTIFY_UNACCEPTED
The remote host did not accept the notify sent from the local device.
#define UPNP_E_CANCELED
The operation was canceled.
#define UPNP_E_SOCKET_READ
An error happened while reading from a socket.
#define UPNP_E_INVALID_SERVICE
The device ID/service ID pair does not refer to a valid service.
#define UPNP_E_INVALID_DESC
The description document passed to UpnpRegisterRootDevice, UpnpRegisterRootDevice2 UpnpRegisterRootDe...
#define UPNP_E_INVALID_PARAM
One or more of the parameters passed to the function is not valid.
#define UPNP_E_URL_TOO_BIG
The URL passed into a function is too long.
#define UPNP_E_INTERNAL_ERROR
Generic error code for internal conditions not covered by other error codes.
#define UPNP_E_BAD_RESPONSE
The response received from the remote side of a connection is not correct for the protocol.
#define UPNP_E_INIT
The SDK has already been initialized.
#define UPNP_E_EXT_NOT_XML
The file name of the description document passed to UpnpRegisterRootDevice2 does not end in "....
char * resolve_rel_url(char *base_url, char *rel_url)
Resolves a relative url with a base url.