1/* $Id: upnpdescgen.h,v 1.22 2011/05/18 22:22:24 nanard Exp $ */ 2/* MiniUPnP project 3 * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ 4 * (c) 2006-2011 Thomas Bernard 5 * This software is subject to the conditions detailed 6 * in the LICENCE file provided within the distribution */ 7 8#ifndef UPNPDESCGEN_H_INCLUDED 9#define UPNPDESCGEN_H_INCLUDED 10 11#include "config.h" 12 13/* for the root description 14 * The child list reference is stored in "data" member using the 15 * INITHELPER macro with index/nchild always in the 16 * same order, whatever the endianness */ 17struct XMLElt { 18 const char * eltname; /* begin with '/' if no child */ 19 const char * data; /* Value */ 20}; 21 22/* for service description */ 23struct serviceDesc { 24 const struct action * actionList; 25 const struct stateVar * serviceStateTable; 26}; 27 28struct action { 29 const char * name; 30 const struct argument * args; 31}; 32 33struct argument { /* the name of the arg is obtained from the variable */ 34 unsigned char dir; /* MSB : don't append "New" Flag, 35 * 5 Medium bits : magic argument name index 36 * 2 LSB : 1 = in, 2 = out */ 37 unsigned char relatedVar; /* index of the related variable */ 38}; 39 40struct stateVar { 41 const char * name; 42 unsigned char itype; /* MSB: sendEvent flag, 7 LSB: index in upnptypes */ 43 unsigned char idefault; /* default value */ 44 unsigned char iallowedlist; /* index in allowed values list 45 * or in allowed range list */ 46 unsigned char ieventvalue; /* fixed value returned or magical values */ 47}; 48 49/* little endian 50 * The code has now be tested on big endian architecture */ 51#define INITHELPER(i, n) ((char *)(((n)<<16)|(i))) 52 53/* char * genRootDesc(int *); 54 * returns: NULL on error, string allocated on the heap */ 55char * 56genRootDesc(int * len); 57 58/* for the two following functions */ 59char * 60genWANIPCn(int * len); 61 62char * 63genWANCfg(int * len); 64 65#ifdef ENABLE_L3F_SERVICE 66char * 67genL3F(int * len); 68#endif 69 70#ifdef ENABLE_6FC_SERVICE 71char * 72gen6FC(int * len); 73#endif 74 75#ifdef ENABLE_DP_SERVICE 76char * 77genDP(int * len); 78#endif 79 80#ifdef ENABLE_EVENTS 81char * 82getVarsWANIPCn(int * len); 83 84char * 85getVarsWANCfg(int * len); 86 87#ifdef ENABLE_L3F_SERVICE 88char * 89getVarsL3F(int * len); 90#endif 91#ifdef ENABLE_6FC_SERVICE 92char * 93getVars6FC(int * len); 94#endif 95#ifdef ENABLE_DP_SERVICE 96char * 97getVarsDP(int * len); 98#endif 99#endif /* ENABLE_EVENTS */ 100 101#endif 102 103