1 /* $Id: upnpdescgen.c,v 1.18 2011/05/02 23:50:52 jmaggard Exp $ */
3 * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
5 * Copyright (c) 2006-2008, Thomas Bernard
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are met:
10 * * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * * The name of the author may not be used to endorse or promote products
16 * derived from this software without specific prior written permission.
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
22 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 * POSSIBILITY OF SUCH DAMAGE.
35 #include "getifaddr.h"
36 #include "upnpdescgen.h"
37 #include "minidlnapath.h"
38 #include "upnpglobalvars.h"
39 #include "upnpdescstrings.h"
43 static const char * const upnptypes
[] =
55 static const char * const upnpdefaultvalues
[] =
61 static const char * const upnpallowedvalues
[] =
77 "Unconfigured", /* 14 */
81 "Unconfigured", /* 18 */
88 "ERROR_NONE", /* 25 */
91 "ContentFormatMismatch",
92 "InsufficientBandwidth",
99 "BrowseMetadata", /* 36 */
100 "BrowseDirectChildren",
102 "COMPLETED", /* 39 */
107 RESOURCE_PROTOCOL_INFO_VALUES
, /* 44 */
115 static const char xmlver
[] =
116 "<?xml version=\"1.0\"?>\r\n";
117 static const char root_service
[] =
118 "scpd xmlns=\"urn:schemas-upnp-org:service-1-0\"";
119 static const char root_device
[] =
120 "root xmlns=\"urn:schemas-upnp-org:device-1-0\""
122 " xmlns:pnpx=\"http://schemas.microsoft.com/windows/pnpx/2005/11\""
123 " xmlns:df=\"http://schemas.microsoft.com/windows/2008/09/devicefoundation\""
127 /* root Description of the UPnP Device */
128 static const struct XMLElt rootDesc
[] =
130 {root_device
, INITHELPER(1,2)},
131 {"specVersion", INITHELPER(3,2)},
132 {"device", INITHELPER(5,(14+PNPX
))},
135 {"/deviceType", "urn:schemas-upnp-org:device:MediaServer:1"},
137 {"/pnpx:X_hardwareId", pnpx_hwid
},
138 {"/pnpx:X_compatibleId", "MS_DigitalMediaDeviceClass_DMS_V001"},
139 {"/pnpx:X_deviceCategory", "MediaDevices"},
140 {"/df:X_deviceCategory", "Multimedia.DMS"},
141 {"/microsoft:magicPacketWakeSupported xmlns:microsoft=\"urn:schemas-microsoft-com:WMPNSS-1-0\"", "0"},
143 {"/friendlyName", friendly_name
}, /* required */
144 {"/manufacturer", ROOTDEV_MANUFACTURER
}, /* required */
145 {"/manufacturerURL", ROOTDEV_MANUFACTURERURL
}, /* optional */
146 {"/modelDescription", ROOTDEV_MODELDESCRIPTION
}, /* recommended */
147 {"/modelName", modelname
}, /* required */
148 {"/modelNumber", modelnumber
},
149 {"/modelURL", ROOTDEV_MODELURL
},
150 {"/serialNumber", serialnumber
},
151 {"/UDN", uuidvalue
}, /* required */
152 {"/dlna:X_DLNADOC xmlns:dlna=\"urn:schemas-dlna-org:device-1-0\"", "DMS-1.50"},
153 {"/presentationURL", presentationurl
}, /* recommended */
154 {"iconList", INITHELPER((19+PNPX
),4)},
155 {"serviceList", INITHELPER((43+PNPX
),3)},
156 {"icon", INITHELPER((23+PNPX
),5)},
157 {"icon", INITHELPER((28+PNPX
),5)},
158 {"icon", INITHELPER((33+PNPX
),5)},
159 {"icon", INITHELPER((38+PNPX
),5)},
160 {"/mimetype", "image/png"},
164 {"/url", "/icons/sm.png"},
165 {"/mimetype", "image/png"},
169 {"/url", "/icons/lrg.png"},
170 {"/mimetype", "image/jpeg"},
174 {"/url", "/icons/sm.jpg"},
175 {"/mimetype", "image/jpeg"},
179 {"/url", "/icons/lrg.jpg"},
180 {"service", INITHELPER((46+PNPX
),5)},
181 {"service", INITHELPER((51+PNPX
),5)},
182 {"service", INITHELPER((56+PNPX
),5)},
183 {"/serviceType", "urn:schemas-upnp-org:service:ContentDirectory:1"},
184 {"/serviceId", "urn:upnp-org:serviceId:ContentDirectory"},
185 {"/controlURL", CONTENTDIRECTORY_CONTROLURL
},
186 {"/eventSubURL", CONTENTDIRECTORY_EVENTURL
},
187 {"/SCPDURL", CONTENTDIRECTORY_PATH
},
188 {"/serviceType", "urn:schemas-upnp-org:service:ConnectionManager:1"},
189 {"/serviceId", "urn:upnp-org:serviceId:ConnectionManager"},
190 {"/controlURL", CONNECTIONMGR_CONTROLURL
},
191 {"/eventSubURL", CONNECTIONMGR_EVENTURL
},
192 {"/SCPDURL", CONNECTIONMGR_PATH
},
193 {"/serviceType", "urn:microsoft.com:service:X_MS_MediaReceiverRegistrar:1"},
194 {"/serviceId", "urn:microsoft.com:serviceId:X_MS_MediaReceiverRegistrar"},
195 {"/controlURL", X_MS_MEDIARECEIVERREGISTRAR_CONTROLURL
},
196 {"/eventSubURL", X_MS_MEDIARECEIVERREGISTRAR_EVENTURL
},
197 {"/SCPDURL", X_MS_MEDIARECEIVERREGISTRAR_PATH
},
201 static const struct argument AddPortMappingArgs
[] =
214 static const struct argument DeletePortMappingArgs
[] =
222 static const struct argument SetConnectionTypeArgs
[] =
228 static const struct argument GetConnectionTypeInfoArgs
[] =
235 static const struct argument GetNATRSIPStatusArgs
[] =
242 static const struct argument GetGenericPortMappingEntryArgs
[] =
256 static const struct argument GetSpecificPortMappingEntryArgs
[] =
269 /* For ConnectionManager */
270 static const struct argument GetProtocolInfoArgs
[] =
277 static const struct argument PrepareForConnectionArgs
[] =
279 {"RemoteProtocolInfo", 1, 6},
280 {"PeerConnectionManager", 1, 4},
281 {"PeerConnectionID", 1, 7},
283 {"ConnectionID", 2, 7},
284 {"AVTransportID", 2, 8},
289 static const struct argument ConnectionCompleteArgs
[] =
291 {"ConnectionID", 1, 7},
295 static const struct argument GetCurrentConnectionIDsArgs
[] =
297 {"ConnectionIDs", 2, 2},
301 static const struct argument GetCurrentConnectionInfoArgs
[] =
303 {"ConnectionID", 1, 7},
305 {"AVTransportID", 2, 8},
306 {"ProtocolInfo", 2, 6},
307 {"PeerConnectionManager", 2, 4},
308 {"PeerConnectionID", 2, 7},
314 static const struct action ConnectionManagerActions
[] =
316 {"GetProtocolInfo", GetProtocolInfoArgs
}, /* R */
317 //OPTIONAL {"PrepareForConnection", PrepareForConnectionArgs}, /* R */
318 //OPTIONAL {"ConnectionComplete", ConnectionCompleteArgs}, /* R */
319 {"GetCurrentConnectionIDs", GetCurrentConnectionIDsArgs
}, /* R */
320 {"GetCurrentConnectionInfo", GetCurrentConnectionInfoArgs
}, /* R */
324 static const struct stateVar ConnectionManagerVars
[] =
326 {"SourceProtocolInfo", 1<<7, 0, 0, 44}, /* required */
327 {"SinkProtocolInfo", 1<<7, 0, 0, 48}, /* required */
328 {"CurrentConnectionIDs", 1<<7, 0, 0, 46}, /* required */
329 {"A_ARG_TYPE_ConnectionStatus", 0, 0, 27}, /* required */
330 {"A_ARG_TYPE_ConnectionManager", 0, 0}, /* required */
331 {"A_ARG_TYPE_Direction", 0, 0, 33}, /* required */
332 {"A_ARG_TYPE_ProtocolInfo", 0, 0}, /* required */
333 {"A_ARG_TYPE_ConnectionID", 4, 0}, /* required */
334 {"A_ARG_TYPE_AVTransportID", 4, 0}, /* required */
335 {"A_ARG_TYPE_RcsID", 4, 0}, /* required */
339 static const struct argument GetSearchCapabilitiesArgs
[] =
341 {"SearchCaps", 2, 10},
345 static const struct argument GetSortCapabilitiesArgs
[] =
351 static const struct argument GetSystemUpdateIDArgs
[] =
357 static const struct argument BrowseArgs
[] =
360 {"BrowseFlag", 1, 4},
362 {"StartingIndex", 1, 7},
363 {"RequestedCount", 1, 8},
364 {"SortCriteria", 1, 6},
366 {"NumberReturned", 2, 8},
367 {"TotalMatches", 2, 8},
372 static const struct argument SearchArgs
[] =
374 {"ContainerID", 1, 1},
375 {"SearchCriteria", 1, 3},
377 {"StartingIndex", 1, 7},
378 {"RequestedCount", 1, 8},
379 {"SortCriteria", 1, 6},
381 {"NumberReturned", 2, 8},
382 {"TotalMatches", 2, 8},
387 static const struct action ContentDirectoryActions
[] =
389 {"GetSearchCapabilities", GetSearchCapabilitiesArgs
}, /* R */
390 {"GetSortCapabilities", GetSortCapabilitiesArgs
}, /* R */
391 {"GetSystemUpdateID", GetSystemUpdateIDArgs
}, /* R */
392 {"Browse", BrowseArgs
}, /* R */
393 {"Search", SearchArgs
}, /* O */
394 #if 0 // Not implementing optional features yet...
395 {"CreateObject", CreateObjectArgs
}, /* O */
396 {"DestroyObject", DestroyObjectArgs
}, /* O */
397 {"UpdateObject", UpdateObjectArgs
}, /* O */
398 {"ImportResource", ImportResourceArgs
}, /* O */
399 {"ExportResource", ExportResourceArgs
}, /* O */
400 {"StopTransferResource", StopTransferResourceArgs
}, /* O */
401 {"GetTransferProgress", GetTransferProgressArgs
}, /* O */
402 {"DeleteResource", DeleteResourceArgs
}, /* O */
403 {"CreateReference", CreateReferenceArgs
}, /* O */
408 static const struct stateVar ContentDirectoryVars
[] =
410 {"TransferIDs", 1<<7, 0, 0, 48}, /* 0 */
411 {"A_ARG_TYPE_ObjectID", 0, 0},
412 {"A_ARG_TYPE_Result", 0, 0},
413 {"A_ARG_TYPE_SearchCriteria", 0, 0},
414 {"A_ARG_TYPE_BrowseFlag", 0, 0, 36},
415 /* Allowed Values : BrowseMetadata / BrowseDirectChildren */
416 {"A_ARG_TYPE_Filter", 0, 0}, /* 5 */
417 {"A_ARG_TYPE_SortCriteria", 0, 0},
418 {"A_ARG_TYPE_Index", 3, 0},
419 {"A_ARG_TYPE_Count", 3, 0},
420 {"A_ARG_TYPE_UpdateID", 3, 0},
421 //JM{"A_ARG_TYPE_TransferID", 3, 0}, /* 10 */
422 //JM{"A_ARG_TYPE_TransferStatus", 0, 0, 39},
423 /* Allowed Values : COMPLETED / ERROR / IN_PROGRESS / STOPPED */
424 //JM{"A_ARG_TYPE_TransferLength", 0, 0},
425 //JM{"A_ARG_TYPE_TransferTotal", 0, 0},
426 //JM{"A_ARG_TYPE_TagValueList", 0, 0},
427 //JM{"A_ARG_TYPE_URI", 5, 0}, /* 15 */
428 {"SearchCapabilities", 0, 0},
429 {"SortCapabilities", 0, 0},
430 {"SystemUpdateID", 3|0x80, 0, 0, 255},
431 //{"ContainerUpdateIDs", 0, 0},
435 static const struct argument GetIsAuthorizedArgs
[] =
442 static const struct argument GetIsValidatedArgs
[] =
449 static const struct argument GetRegisterDeviceArgs
[] =
451 {"RegistrationReqMsg", 1, 1},
452 {"RegistrationRespMsg", 2, 2},
456 static const struct action X_MS_MediaReceiverRegistrarActions
[] =
458 {"IsAuthorized", GetIsAuthorizedArgs
}, /* R */
459 {"IsValidated", GetIsValidatedArgs
}, /* R */
460 #if 0 // Not needed? WMP12 still works. Need to check with 360 and WMP11.
461 {"RegisterDevice", GetRegisterDeviceArgs
}, /* R */
466 static const struct stateVar X_MS_MediaReceiverRegistrarVars
[] =
468 {"A_ARG_TYPE_DeviceID", 0, 0},
469 {"A_ARG_TYPE_RegistrationReqMsg", 7, 0},
470 {"A_ARG_TYPE_RegistrationRespMsg", 7, 0},
471 {"A_ARG_TYPE_Result", 6, 0},
472 {"AuthorizationDeniedUpdateID", 3, 0},
473 {"AuthorizationGrantedUpdateID", 3, 0},
474 {"ValidationRevokedUpdateID", 3, 0},
475 {"ValidationSucceededUpdateID", 3, 0},
480 /* See UPnP_IGD_WANCommonInterfaceConfig 1.0.pdf */
482 static const struct argument GetCommonLinkPropertiesArgs
[] =
491 static const struct argument GetTotalBytesSentArgs
[] =
497 static const struct argument GetTotalBytesReceivedArgs
[] =
503 static const struct argument GetTotalPacketsSentArgs
[] =
509 static const struct argument GetTotalPacketsReceivedArgs
[] =
515 static const struct serviceDesc scpdContentDirectory
=
516 { ContentDirectoryActions
, ContentDirectoryVars
};
518 static const struct serviceDesc scpdConnectionManager
=
519 { ConnectionManagerActions
, ConnectionManagerVars
};
521 static const struct serviceDesc scpdX_MS_MediaReceiverRegistrar
=
522 { X_MS_MediaReceiverRegistrarActions
, X_MS_MediaReceiverRegistrarVars
};
525 * concatenate the string and use realloc to increase the
526 * memory buffer if needed. */
528 strcat_str(char * str
, int * len
, int * tmplen
, const char * s2
)
532 s2len
= (int)strlen(s2
);
533 if(*tmplen
<= (*len
+ s2len
))
538 *tmplen
+= s2len
+ 1;
539 p
= realloc(str
, *tmplen
);
545 *tmplen
-= s2len
+ 1;
551 /*strcpy(str + *len, s2); */
552 memcpy(str
+ *len
, s2
, s2len
+ 1);
558 * concatenate a character and use realloc to increase the
559 * size of the memory buffer if needed */
561 strcat_char(char * str
, int * len
, int * tmplen
, char c
)
564 if(*tmplen
<= (*len
+ 1))
567 p
= (char *)realloc(str
, *tmplen
);
581 /* iterative subroutine using a small stack
582 * This way, the progam stack usage is kept low */
584 genXML(char * str
, int * len
, int * tmplen
,
585 const struct XMLElt
* p
)
589 const char * eltname
, *s
;
595 const char * eltname
;
596 } pile
[16]; /* stack */
598 i
= 0; /* current node */
599 j
= 1; /* i + number of nodes*/
602 eltname
= p
[i
].eltname
;
605 if(eltname
[0] == '/')
608 printf("DBG: <%s>%s<%s>\n", eltname
+1, p
[i
].data
, eltname
);
610 str
= strcat_char(str
, len
, tmplen
, '<');
611 str
= strcat_str(str
, len
, tmplen
, eltname
+1);
612 str
= strcat_char(str
, len
, tmplen
, '>');
613 str
= strcat_str(str
, len
, tmplen
, p
[i
].data
);
614 str
= strcat_char(str
, len
, tmplen
, '<');
615 sscanf(eltname
, "%s", element
);
616 str
= strcat_str(str
, len
, tmplen
, element
);
617 str
= strcat_char(str
, len
, tmplen
, '>');
625 printf("DBG: pile[%d]\t%d %d\n", top
, i
, j
);
630 printf("DBG: i==j, </%s>\n", pile
[top
].eltname
);
632 str
= strcat_char(str
, len
, tmplen
, '<');
633 str
= strcat_char(str
, len
, tmplen
, '/');
634 s
= pile
[top
].eltname
;
635 for(c
= *s
; c
> ' '; c
= *(++s
))
636 str
= strcat_char(str
, len
, tmplen
, c
);
637 str
= strcat_char(str
, len
, tmplen
, '>');
647 printf("DBG: [%d] <%s>\n", i
, eltname
);
649 str
= strcat_char(str
, len
, tmplen
, '<');
650 str
= strcat_str(str
, len
, tmplen
, eltname
);
651 str
= strcat_char(str
, len
, tmplen
, '>');
654 /*j = i + p[k].nchild; */
655 i
= (unsigned long)p
[k
].data
& 0xffff;
656 j
= i
+ ((unsigned long)p
[k
].data
>> 16);
659 printf("DBG: +pile[%d]\t%d %d\n", top
, i
, j
);
663 pile
[top
].eltname
= eltname
;
669 * - Generate the root description of the UPnP device.
670 * - the len argument is used to return the length of
671 * the returned string.
672 * - tmp_uuid argument is used to build the uuid string */
674 genRootDesc(int * len
)
679 str
= (char *)malloc(tmplen
);
682 * len
= strlen(xmlver
);
683 /*strcpy(str, xmlver); */
684 memcpy(str
, xmlver
, *len
+ 1);
685 str
= genXML(str
, len
, &tmplen
, rootDesc
);
690 /* genServiceDesc() :
691 * Generate service description with allowed methods and
692 * related variables. */
694 genServiceDesc(int * len
, const struct serviceDesc
* s
)
697 const struct action
* acts
;
698 const struct stateVar
* vars
;
699 const struct argument
* args
;
704 str
= (char *)malloc(tmplen
);
707 /*strcpy(str, xmlver); */
708 *len
= strlen(xmlver
);
709 memcpy(str
, xmlver
, *len
+ 1);
711 acts
= s
->actionList
;
712 vars
= s
->serviceStateTable
;
714 str
= strcat_char(str
, len
, &tmplen
, '<');
715 str
= strcat_str(str
, len
, &tmplen
, root_service
);
716 str
= strcat_char(str
, len
, &tmplen
, '>');
718 str
= strcat_str(str
, len
, &tmplen
,
719 "<specVersion><major>1</major><minor>0</minor></specVersion>");
722 str
= strcat_str(str
, len
, &tmplen
, "<actionList>");
725 str
= strcat_str(str
, len
, &tmplen
, "<action><name>");
726 str
= strcat_str(str
, len
, &tmplen
, acts
[i
].name
);
727 str
= strcat_str(str
, len
, &tmplen
, "</name>");
732 str
= strcat_str(str
, len
, &tmplen
, "<argumentList>");
736 str
= strcat_str(str
, len
, &tmplen
, "<argument><name>");
737 p
= vars
[args
[j
].relatedVar
].name
;
738 str
= strcat_str(str
, len
, &tmplen
, (args
[j
].name
? args
[j
].name
: p
));
739 str
= strcat_str(str
, len
, &tmplen
, "</name><direction>");
740 str
= strcat_str(str
, len
, &tmplen
, args
[j
].dir
==1?"in":"out");
741 str
= strcat_str(str
, len
, &tmplen
,
742 "</direction><relatedStateVariable>");
743 str
= strcat_str(str
, len
, &tmplen
, p
);
744 str
= strcat_str(str
, len
, &tmplen
,
745 "</relatedStateVariable></argument>");
748 str
= strcat_str(str
, len
, &tmplen
,"</argumentList>");
750 str
= strcat_str(str
, len
, &tmplen
, "</action>");
751 /*str = strcat_char(str, len, &tmplen, '\n'); // TEMP ! */
754 str
= strcat_str(str
, len
, &tmplen
, "</actionList><serviceStateTable>");
758 str
= strcat_str(str
, len
, &tmplen
,
759 "<stateVariable sendEvents=\"");
760 str
= strcat_str(str
, len
, &tmplen
, (vars
[i
].itype
& 0x80)?"yes":"no");
761 str
= strcat_str(str
, len
, &tmplen
, "\"><name>");
762 str
= strcat_str(str
, len
, &tmplen
, vars
[i
].name
);
763 str
= strcat_str(str
, len
, &tmplen
, "</name><dataType>");
764 str
= strcat_str(str
, len
, &tmplen
, upnptypes
[vars
[i
].itype
& 0x0f]);
765 str
= strcat_str(str
, len
, &tmplen
, "</dataType>");
766 if(vars
[i
].iallowedlist
)
768 str
= strcat_str(str
, len
, &tmplen
, "<allowedValueList>");
769 for(j
=vars
[i
].iallowedlist
; upnpallowedvalues
[j
]; j
++)
771 str
= strcat_str(str
, len
, &tmplen
, "<allowedValue>");
772 str
= strcat_str(str
, len
, &tmplen
, upnpallowedvalues
[j
]);
773 str
= strcat_str(str
, len
, &tmplen
, "</allowedValue>");
775 str
= strcat_str(str
, len
, &tmplen
, "</allowedValueList>");
777 /*if(vars[i].defaultValue) */
780 str
= strcat_str(str
, len
, &tmplen
, "<defaultValue>");
781 /*str = strcat_str(str, len, &tmplen, vars[i].defaultValue); */
782 str
= strcat_str(str
, len
, &tmplen
, upnpdefaultvalues
[vars
[i
].idefault
]);
783 str
= strcat_str(str
, len
, &tmplen
, "</defaultValue>");
785 str
= strcat_str(str
, len
, &tmplen
, "</stateVariable>");
786 /*str = strcat_char(str, len, &tmplen, '\n'); // TEMP ! */
789 str
= strcat_str(str
, len
, &tmplen
, "</serviceStateTable></scpd>");
794 /* genContentDirectory() :
795 * Generate the ContentDirectory xml description */
797 genContentDirectory(int * len
)
799 return genServiceDesc(len
, &scpdContentDirectory
);
802 /* genConnectionManager() :
803 * Generate the ConnectionManager xml description */
805 genConnectionManager(int * len
)
807 return genServiceDesc(len
, &scpdConnectionManager
);
810 /* genX_MS_MediaReceiverRegistrar() :
811 * Generate the X_MS_MediaReceiverRegistrar xml description */
813 genX_MS_MediaReceiverRegistrar(int * len
)
815 return genServiceDesc(len
, &scpdX_MS_MediaReceiverRegistrar
);
819 genEventVars(int * len
, const struct serviceDesc
* s
, const char * servns
)
821 const struct stateVar
* v
;
826 str
= (char *)malloc(tmplen
);
830 v
= s
->serviceStateTable
;
831 snprintf(buf
, sizeof(buf
), "<e:propertyset xmlns:e=\"urn:schemas-upnp-org:event-1-0\" xmlns:s=\"%s\">", servns
);
832 str
= strcat_str(str
, len
, &tmplen
, buf
);
834 if(v
->itype
& 0x80) {
835 snprintf(buf
, sizeof(buf
), "<e:property><%s>", v
->name
);
836 str
= strcat_str(str
, len
, &tmplen
, buf
);
837 //printf("<e:property><s:%s>", v->name);
838 switch(v
->ieventvalue
) {
841 case 255: /* Magical values should go around here */
842 if( strcmp(v
->name
, "SystemUpdateID") == 0 )
844 snprintf(buf
, sizeof(buf
), "%d", updateID
);
845 str
= strcat_str(str
, len
, &tmplen
, buf
);
849 str
= strcat_str(str
, len
, &tmplen
, upnpallowedvalues
[v
->ieventvalue
]);
850 //printf("%s", upnpallowedvalues[v->ieventvalue]);
852 snprintf(buf
, sizeof(buf
), "</%s></e:property>", v
->name
);
853 str
= strcat_str(str
, len
, &tmplen
, buf
);
854 //printf("</s:%s></e:property>\n", v->name);
858 str
= strcat_str(str
, len
, &tmplen
, "</e:propertyset>");
859 //printf("</e:propertyset>\n");
861 //printf("%d\n", tmplen);
867 getVarsContentDirectory(int * l
)
869 return genEventVars(l
,
870 &scpdContentDirectory
,
871 "urn:schemas-upnp-org:service:ContentDirectory:1");
875 getVarsConnectionManager(int * l
)
877 return genEventVars(l
,
878 &scpdConnectionManager
,
879 "urn:schemas-upnp-org:service:ConnectionManager:1");
883 getVarsX_MS_MediaReceiverRegistrar(int * l
)
885 return genEventVars(l
,
886 &scpdX_MS_MediaReceiverRegistrar
,
887 "urn:microsoft.com:service:X_MS_MediaReceiverRegistrar:1");