1: /* $Id: upnpdescgen.h,v 1.1.1.3 2013/07/22 00:32:35 misho 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 */
17: struct XMLElt {
18: const char * eltname; /* begin with '/' if no child */
19: const char * data; /* Value */
20: };
21:
22: /* for service description */
23: struct serviceDesc {
24: const struct action * actionList;
25: const struct stateVar * serviceStateTable;
26: };
27:
28: struct action {
29: const char * name;
30: const struct argument * args;
31: };
32:
33: struct 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:
40: struct 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 */
55: char *
56: genRootDesc(int * len);
57:
58: /* for the two following functions */
59: char *
60: genWANIPCn(int * len);
61:
62: char *
63: genWANCfg(int * len);
64:
65: #ifdef ENABLE_L3F_SERVICE
66: char *
67: genL3F(int * len);
68: #endif
69:
70: #ifdef ENABLE_6FC_SERVICE
71: char *
72: gen6FC(int * len);
73: #endif
74:
75: #ifdef ENABLE_DP_SERVICE
76: char *
77: genDP(int * len);
78: #endif
79:
80: #ifdef ENABLE_EVENTS
81: char *
82: getVarsWANIPCn(int * len);
83:
84: char *
85: getVarsWANCfg(int * len);
86:
87: #ifdef ENABLE_L3F_SERVICE
88: char *
89: getVarsL3F(int * len);
90: #endif
91: #ifdef ENABLE_6FC_SERVICE
92: char *
93: getVars6FC(int * len);
94: #endif
95: #ifdef ENABLE_DP_SERVICE
96: char *
97: getVarsDP(int * len);
98: #endif
99: #endif /* ENABLE_EVENTS */
100:
101: #endif
102:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>