1/* MiniUPnP project 2 * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ 3 * (c) 2006-2008 Thomas Bernard 4 * This software is subject to the conditions detailed 5 * in the LICENCE file provided within the distribution */ 6 7#ifndef __UPNPDESCGEN_H__ 8#define __UPNPDESCGEN_H__ 9 10#include "config.h" 11 12/* for the root description 13 * The child list reference is stored in "data" member using the 14 * INITHELPER macro with index/nchild always in the 15 * same order, whatever the endianness */ 16struct XMLElt { 17 const char * eltname; /* begin with '/' if no child */ 18 const char * data; /* Value */ 19}; 20 21/* for service description */ 22struct serviceDesc { 23 const struct action * actionList; 24 const struct stateVar * serviceStateTable; 25}; 26 27struct action { 28 const char * name; 29 const struct argument * args; 30}; 31 32struct argument { 33 const char * name; /* the name of the argument */ 34 unsigned char dir; /* 1 = in, 2 = out */ 35 unsigned char relatedVar; /* index of the related variable */ 36}; 37 38struct stateVar { 39 const char * name; 40 unsigned char itype; /* MSB: sendEvent flag, 7 LSB: index in upnptypes */ 41 unsigned char idefault; /* default value */ 42 unsigned char iallowedlist; /* index in allowed values list */ 43 unsigned char ieventvalue; /* fixed value returned or magical values */ 44}; 45 46/* little endian 47 * The code has now be tested on big endian architecture */ 48#define INITHELPER(i, n) ((char *)((n<<16)|i)) 49 50/* char * genRootDesc(int *); 51 * returns: NULL on error, string allocated on the heap */ 52char * 53genRootDesc(int * len); 54 55/* for the two following functions */ 56char * 57genContentDirectory(int * len); 58 59char * 60genConnectionManager(int * len); 61 62char * 63genX_MS_MediaReceiverRegistrar(int * len); 64 65char * 66genWANIPCn(int * len); 67 68char * 69genWANCfg(int * len); 70 71char * 72getVarsContentDirectory(int * len); 73 74char * 75getVarsConnectionManager(int * len); 76 77char * 78getVarsX_MS_MediaReceiverRegistrar(int * len); 79 80#endif 81 82