summaryrefslogtreecommitdiff
path: root/source/aparser
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2000-05-16 14:02:31 +0000
committerAndrew Tridgell <tridge@samba.org>2000-05-16 14:02:31 +0000
commit03fbe1b1514774c9f3c4d553ca3b5b019ba0b11f (patch)
treebfbb733ebbe20d26597b62f43ddbac826b8d9f19 /source/aparser
parentca8f1e92adf3603ad15f73277576cc9178bb4d74 (diff)
downloadsamba-03fbe1b1514774c9f3c4d553ca3b5b019ba0b11f.tar.gz
take the sructure name to run through vluke on the command line
Diffstat (limited to 'source/aparser')
-rw-r--r--source/aparser/harness.awk19
-rw-r--r--source/aparser/main.awk2
-rw-r--r--source/aparser/parsefn.awk3
-rw-r--r--source/aparser/parsetree.awk1
-rw-r--r--source/aparser/srvsvc.struct82
-rw-r--r--source/aparser/templates/harness_start.tpl11
-rw-r--r--source/aparser/vluke.c14
7 files changed, 98 insertions, 34 deletions
diff --git a/source/aparser/harness.awk b/source/aparser/harness.awk
index 00e3f44a682..f63863d6385 100644
--- a/source/aparser/harness.awk
+++ b/source/aparser/harness.awk
@@ -1,13 +1,22 @@
function produce_harness(f,
- LOCAL, v, struct_num)
+ LOCAL, v, struct_num, i)
{
struct_num=structs[test];
v["MODULE"]=module;
- v["TEST"]=test;
- v["TEST_FUNC"]=moduletest;
- v["STRUCTNAME"] = structs[struct_num, "name"];
- v["FUNCNAME"] = "io_" v["STRUCTNAME"];
print_template(f, "harness_start.tpl", v);
+
+ for (i=0;i<num_tests;i++) {
+ v["TEST"] = tests[i];
+ print_template(f, "harness.tpl", v);
+ }
+
+ print_template(f, "harness_end.tpl", v);
+}
+
+function add_test(test)
+{
+ tests[num_tests] = test;
+ num_tests++;
}
diff --git a/source/aparser/main.awk b/source/aparser/main.awk
index d891970c684..5d67f123c79 100644
--- a/source/aparser/main.awk
+++ b/source/aparser/main.awk
@@ -14,7 +14,7 @@
}
/^test/ {
- test=$2;
+ add_test($2);
next;
}
diff --git a/source/aparser/parsefn.awk b/source/aparser/parsefn.awk
index 3f1e3e8093f..4c88cdeab82 100644
--- a/source/aparser/parsefn.awk
+++ b/source/aparser/parsefn.awk
@@ -142,7 +142,8 @@ function struct_parser(f, v, struct_num,
# and any trailers
for (i=n1;i<structs[struct_num, "num_elems"];i++) {
- parse_buffers(f, v, structs[struct_num, i], "PARSE_SCALARS");
+ parse_scalars(f, v, structs[struct_num, i], "PARSE_SCALARS");
+ parse_buffers(f, v, structs[struct_num, i], "PARSE_BUFFERS");
}
print_template(f, "fn_end.tpl", v);
diff --git a/source/aparser/parsetree.awk b/source/aparser/parsetree.awk
index 6f2697ec91f..cd4e442c9b8 100644
--- a/source/aparser/parsetree.awk
+++ b/source/aparser/parsetree.awk
@@ -6,6 +6,7 @@ function start_module(name)
num_structs=0;
num_elements=0;
num_unions=0;
+ num_tests=0;
}
function start_struct(name)
diff --git a/source/aparser/srvsvc.struct b/source/aparser/srvsvc.struct
index 44d88944cbc..f8dd94a2e69 100644
--- a/source/aparser/srvsvc.struct
+++ b/source/aparser/srvsvc.struct
@@ -1,5 +1,16 @@
module srvsvc
+test SRV_R_NET_SHARE_ENUM
test SRV_R_NET_SERVER_INFO
+test SRV_Q_NET_SERVER_INFO
+
+#define SRV_NETCONNENUM 0x08
+#define SRV_NETFILEENUM 0x09
+#define SRV_NETSESSENUM 0x0c
+#define SRV_NETSHAREENUM 0x0f
+#define SRV_NET_SHARE_GET_INFO 0x10
+#define SRV_NET_SRV_GET_INFO 0x15
+#define SRV_NET_SRV_SET_INFO 0x16
+#define SRV_NET_REMOTE_TOD 0x1c
struct UNISTR2 {
uint32 max_len;
@@ -12,6 +23,40 @@ struct LPWSTR {
UNISTR2 *str;
};
+struct ENUM_HND {
+ uint32 *handle; /* enumeration handle */
+};
+
+/* function 8 */
+struct CONN_INFO_0 {
+ uint32 id; /* connection id. */
+};
+
+struct CONN_INFO_1 {
+ uint32 id;
+ uint32 type;
+ uint32 num_opens;
+ uint32 num_users;
+ uint32 open_time;
+ LPWSTR usr_name;
+ LPWSTR net_name;
+};
+
+struct SRV_R_NET_CONN_ENUM {
+ uint32 level;
+ uint32 level2;
+ uint32 num_entries;
+ union *info[level] {
+ case 0 CONN_INFO_0 info0[num_entries];
+ case 1 CONN_INFO_1 info1[num_entries];
+ }
+ .trailer;
+ uint32 count;
+ ENUM_HND handle;
+ uint32 status1;
+ uint32 status2;
+};
+
/* function 15 */
struct SRV_SHARE_INFO_1 {
LPWSTR uni_netname;
@@ -63,28 +108,35 @@ struct SERVER_INFO_101 {
};
struct SERVER_INFO_102 {
- uint32 dwPlatformID;
+ uint32 dwPlatformID;
LPWSTR pszName;
- uint32 dwVerMajor;
- uint32 dwVerMinor;
- uint32 dwType;
+ uint32 dwVerMajor;
+ uint32 dwVerMinor;
+ uint32 dwType;
LPWSTR pszComment;
- uint32 dwUsers;
- uint32 lDisc;
- uint32 bHidden;
- uint32 dwAnnounce;
- uint32 dwAnnDelta;
- uint32 dwLicenses;
+ uint32 dwUsers;
+ uint32 lDisc;
+ uint32 bHidden;
+ uint32 dwAnnounce;
+ uint32 dwAnnDelta;
+ uint32 dwLicenses;
LPWSTR pszUserPath;
};
struct SRV_R_NET_SERVER_INFO {
+ .trailer;
uint32 level;
- union info[level] {
- case 100 SERVER_INFO_100 *sv100;
- case 101 SERVER_INFO_101 *sv101;
- case 102 SERVER_INFO_102 *sv102;
+ union *info[level] {
+ case 100 SERVER_INFO_100 sv100;
+ case 101 SERVER_INFO_101 sv101;
+ case 102 SERVER_INFO_102 sv102;
}
- .trailer;
uint32 status;
};
+
+struct SRV_Q_NET_SERVER_INFO {
+ .trailer;
+ LPWSTR server;
+ uint32 level;
+};
+
diff --git a/source/aparser/templates/harness_start.tpl b/source/aparser/templates/harness_start.tpl
index 7e6ab9dc3ac..e6cf18a163a 100644
--- a/source/aparser/templates/harness_start.tpl
+++ b/source/aparser/templates/harness_start.tpl
@@ -1,7 +1,8 @@
-#define TEST_STRUCT @STRUCTNAME@
-#define TEST_NAME "@TEST@"
-#define TEST_FUNC @FUNCNAME@
-
-
#include "prs_@MODULE@.h"
#include "prs_@MODULE@.c"
+
+static BOOL run_test(char *test, prs_struct *ps)
+{
+ BOOL ret;
+
+ \ No newline at end of file
diff --git a/source/aparser/vluke.c b/source/aparser/vluke.c
index f5612a773d5..5a64e06eb05 100644
--- a/source/aparser/vluke.c
+++ b/source/aparser/vluke.c
@@ -11,18 +11,19 @@
int main(int argc, char *argv[])
{
BOOL ret;
- TEST_STRUCT *il;
- char *desc = TEST_NAME;
- char *fname = argv[1];
+ char *fname, *test;
int fd;
struct stat st;
prs_struct ps;
- if (argc < 2) {
- printf("usage: vluke <file>\n");
+ if (argc < 3) {
+ printf("usage: vluke <structure> <file>\n");
exit(1);
}
+ test = argv[1];
+ fname = argv[2];
+
fd = open(fname,O_RDONLY);
fstat(fd, &st);
@@ -31,8 +32,7 @@ int main(int argc, char *argv[])
prs_read(&ps, fd, st.st_size, 0);
ps.data_offset = 0;
ps.io = UNMARSHALL;
- il = (TEST_STRUCT *)malloc(sizeof(*il));
- ret = TEST_FUNC(desc, &ps, 1, il, PARSE_SCALARS|PARSE_BUFFERS);
+ ret = run_test(test, &ps);
printf("\nret=%s\n", ret?"OK":"Bad");
printf("Trailer is %d bytes\n\n", ps.grow_size - ps.data_offset);
dump_data(0, ps.data_p, ps.grow_size);