diff -uNr xml-HTB-1.0/Changelog xml-HTB-1.1/Changelog
--- xml-HTB-1.0/Changelog 1970-01-01 02:00:00.000000000 +0200
+++ xml-HTB-1.1/Changelog 2004-05-12 12:17:07.000000000 +0300
@@ -0,0 +1,25 @@
+xml-HTB Changelog
+
+* 1.1
+Fixed classid generation bug when changing depths. If the configuration
+having more than 1 depth, the classid were resets from 1. In example:
+
+
+
+
+
+
+
+
+
+
+
+
+
+l3-11 have same classid with l3-21 and l3-12 with l3-22. This issue make the
+generation script UNUSABLE!!
+
+Thanks to Charles J. Boening for reporting of the problem.
+
+* 1.0
+Initial release
diff -uNr xml-HTB-1.0/README xml-HTB-1.1/README
--- xml-HTB-1.0/README 2004-03-19 09:50:18.000000000 +0200
+++ xml-HTB-1.1/README 2004-05-12 12:17:07.000000000 +0300
@@ -1,32 +1,34 @@
xml-HTB tools
-Aceasta este o versiune beta, numai pentru test. NU recomand folosirea in
-productie, chiar daca este cat de cat stabila (??)
+** Installing **
-Se compileaza cu make, se instaleaza cu make install.
+Edit Makefile and set the PREFIX variable to the desired location.
+Type make for compiling and make install for installing
-Dependinte:
- - libxml2: ar trebui sa fie in orice distributie, daca nu:
- http://www.xmlsoft.org/
+Depends on:
+ - libxml2: it is in every big GNU/Linux distribution. If not, download
+ and install it from: http://xmlsoft.org/
-Editati fisierul Makefile pentru a specifica locatia de instalare, variabila
-PREFIX.
+** Documentation **
+I hadn't time for writing a documentation. If you have some minimal HTML or XML
+knowledgements, it's easy to understand how to write the config file.
-Deocamdata nu exista nici un fel de documentatie. Atributele elementelor XML
-se pot vedea in $PREFIX/etc/dtd/c-xml-HTB.dtd (pentru cunoscatori).
-Majoritatea atributelor, insa, exista in fisierele sample: complex.xml si
-simple.xml.
+There is two configuration files that are self explainory.
-Pentru rulare: xml-HTB path_to_config_file/file.xml
+If you want to write documentation for xml-HTB, write me an e-mail. The
+address can be found at: http://www.sf.net/projects/xml-htb.
-Programul face validare automata a fisierului xml conform DTD-ului, la
-rularea programului se pot vedea errors sau warnings daca ceva nu iese bine.
+** Using the tool **
-Deocamdata, cam atata. Acest fisier nu va ramane cu acest continut, el va fi
-rescris cand o sa am ceva timp.
+For script generation, use:
-Orice nelamurire, observatie etc, scrieti pe adresa claudiu at cnixs dot
-com.
+prompt$ xml-HTB PREFIX/etc/config_file.xml
-Multumesc,
+You can pipe the output through sh or bash, or redirect it to a file and run
+later.
+
+The software automaticly validates the xml file with the dtd file installed in
+PREFIX/etc/dtd.
+
+Thanks,
Claudiu Cismaru
diff -uNr xml-HTB-1.0/src/Makefile xml-HTB-1.1/src/Makefile
--- xml-HTB-1.0/src/Makefile 2004-03-19 09:50:18.000000000 +0200
+++ xml-HTB-1.1/src/Makefile 2004-05-12 11:13:12.000000000 +0300
@@ -19,7 +19,7 @@
main.o: main.c globals.h stack.h
$(CC) $(CFLAGS) $(XMLCFLAGS) -c main.c
-stack.o: stack.h
+stack.o: stack.c stack.h
$(CC) $(CFLAGS) $(XMLCFLAGS) -c stack.c
clean:
diff -uNr xml-HTB-1.0/src/main.c xml-HTB-1.1/src/main.c
--- xml-HTB-1.0/src/main.c 2004-03-19 09:50:18.000000000 +0200
+++ xml-HTB-1.1/src/main.c 2004-05-12 11:13:12.000000000 +0300
@@ -25,6 +25,7 @@
#include
#include
#include "globals.h"
+#include "stack.h"
void usage (char *progname) {
@@ -129,6 +130,7 @@
node = node->children;
+ lvlStackInit ();
handleDoc (doc, node);
free (configFile);
diff -uNr xml-HTB-1.0/src/parse-doc.c xml-HTB-1.1/src/parse-doc.c
--- xml-HTB-1.0/src/parse-doc.c 2004-03-19 09:50:18.000000000 +0200
+++ xml-HTB-1.1/src/parse-doc.c 2004-05-12 11:13:12.000000000 +0300
@@ -88,11 +88,12 @@
currentId = depth * CLS_PER_DEPTH + lvlIdx;
- if (lvlStackCurrent (&tmpVal) < 0)
- tmpVal = 0;
+ tmpVal = 0;
- if (depth > 0)
+ if (depth > 0) {
+ lvlStackGet (depth - 1, &tmpVal);
parentId = (depth - 1) * CLS_PER_DEPTH + tmpVal - 1;
+ }
else
parentId = depth * CLS_PER_DEPTH + tmpVal;
@@ -135,7 +136,7 @@
printf ("\n# add class, name: %s\n", name);
if ((useIf & XML_HTB_IFIN) > 0) {
- printf ("$TC class add dev $DEV parent 0x01:%04x classid 0x01:0x%04x htb rate %s ceil %s",
+ printf ("$TC class add dev $DEV parent 0x01:0x%04x classid 0x01:0x%04x htb rate %s ceil %s",
parentId, currentId, rate, ceil);
if (burst != NULL)
@@ -155,7 +156,7 @@
if ((useIf & XML_HTB_IFOUT) > 0) {
- printf ("$TC class add dev $OUTDEV parent 0x01:%04x classid 0x01:0x%04x htb rate %s ceil %s",
+ printf ("$TC class add dev $OUTDEV parent 0x01:0x%04x classid 0x01:0x%04x htb rate %s ceil %s",
parentId, currentId, outrate, outceil);
if (burst != NULL)
@@ -193,8 +194,10 @@
uint32_t tmpVal;
- if (lvlStackCurrent (&tmpVal) < 0)
- tmpVal = 0;
+ tmpVal = 0;
+
+ if (depth > 0)
+ lvlStackGet (depth - 1, &tmpVal);
parentId = (depth - 1) * CLS_PER_DEPTH + tmpVal - 1;
@@ -320,8 +323,10 @@
uint32_t tmpVal;
- if (lvlStackCurrent (&tmpVal) < 0)
- tmpVal = 0;
+ tmpVal = 0;
+
+ if (depth > 0)
+ lvlStackGet (depth - 1, &tmpVal);
parentId = (depth - 1) * CLS_PER_DEPTH + tmpVal - 1;
@@ -380,12 +385,13 @@
if (cur->children != NULL) {
depth++;
- lvlStackPush (lvlIdx);
- lvlIdx = 1;
+ lvlStackSet (depth - 1, lvlIdx);
+ lvlStackGet (depth, &lvlIdx);
handleDoc (doc, cur->children);
- lvlStackPop (&lvlIdx);
+ lvlStackSet (depth, lvlIdx);
+ lvlStackGet (depth - 1, &lvlIdx);
depth--;
}
diff -uNr xml-HTB-1.0/src/stack.c xml-HTB-1.1/src/stack.c
--- xml-HTB-1.0/src/stack.c 2004-03-19 09:50:18.000000000 +0200
+++ xml-HTB-1.1/src/stack.c 2004-05-12 11:13:12.000000000 +0300
@@ -23,55 +23,19 @@
#include
#include "stack.h"
-struct lvlStackMember *lvlStack = NULL;
+uint32_t lvlStack[_C_XML_HTB_MAXDEPTH];
-struct lvlStackMember *cur = NULL;
-
-void lvlStackPush (uint32_t value) {
-
- struct lvlStackMember *tmp;
-
- /* alloc */
- tmp = (struct lvlStackMember *) malloc (sizeof (struct lvlStackMember));
-
- /* set value */
- tmp->value = value;
- tmp->next = NULL;
-
- if (lvlStack == NULL)
- lvlStack = tmp;
-
- /* we assume the compiler knows to set the default value */
-
- tmp->prev = cur;
-
- cur = tmp;
+void lvlStackInit (void) {
+ int i;
+ for (i = 0; i < _C_XML_HTB_MAXDEPTH; i++)
+ lvlStack [i] = (uint32_t) 1;
}
-int lvlStackPop (uint32_t *value) {
-
- struct lvlStackMember *tmp;
-
- if (cur == NULL)
- return (-1);
-
- *value = cur->value;
-
- tmp = cur->prev;
-
- free (cur);
-
- cur = tmp;
-
- return (0);
+void lvlStackSet (int depth, uint32_t value) {
+ lvlStack [depth] = value;
}
-int lvlStackCurrent (uint32_t *value) {
-
- if (cur == NULL)
- return (-1);
-
- *value = cur->value;
-
+int lvlStackGet (int depth, uint32_t *value) {
+ *value = lvlStack [depth];
return (0);
}
diff -uNr xml-HTB-1.0/src/stack.h xml-HTB-1.1/src/stack.h
--- xml-HTB-1.0/src/stack.h 2004-03-19 09:50:18.000000000 +0200
+++ xml-HTB-1.1/src/stack.h 2004-05-12 11:13:12.000000000 +0300
@@ -25,13 +25,10 @@
#include
-struct lvlStackMember {
- uint32_t value;
- struct lvlStackMember *next, *prev;
-};
+#define _C_XML_HTB_MAXDEPTH 1024
-void lvlStackPush (uint32_t);
-int lvlStackPop (uint32_t *);
-int lvlStackCurrent (uint32_t *);
+void lvlStackInit (void);
+void lvlStackSet (int, uint32_t);
+int lvlStackGet (int, uint32_t *);
#endif